File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Plugins/Flow.Launcher.Plugin.BrowserBookmark Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -155,12 +155,18 @@ private void StartFirefoxBookmarkTimer()
155
155
156
156
_firefoxBookmarkTimer = new PeriodicTimer ( FirefoxPollingInterval ) ;
157
157
158
+ var timer = _firefoxBookmarkTimer ! ;
158
159
_ = Task . Run ( async ( ) =>
159
160
{
160
- while ( await _firefoxBookmarkTimer . WaitForNextTickAsync ( _cancellationTokenSource . Token ) )
161
+ try
161
162
{
162
- await ReloadFirefoxBookmarksAsync ( ) ;
163
+ while ( await timer . WaitForNextTickAsync ( _cancellationTokenSource . Token ) )
164
+ {
165
+ await ReloadFirefoxBookmarksAsync ( ) ;
166
+ }
163
167
}
168
+ catch ( OperationCanceledException ) { }
169
+ catch ( ObjectDisposedException ) { }
164
170
} , _cancellationTokenSource . Token ) ;
165
171
}
166
172
Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ private void LoadFailedFetches()
74
74
75
75
private async Task SaveFailedFetchesAsync ( )
76
76
{
77
- await _fileLock . WaitAsync ( _cts . Token ) ;
77
+ var acquired = false ;
78
78
try
79
79
{
80
+ await _fileLock . WaitAsync ( _cts . Token ) ;
81
+ acquired = true ;
80
82
var json = JsonSerializer . Serialize ( _failedFetches ) ;
81
83
await File . WriteAllTextAsync ( _failsFilePath , json , _cts . Token ) ;
82
84
}
@@ -87,7 +89,8 @@ private async Task SaveFailedFetchesAsync()
87
89
}
88
90
finally
89
91
{
90
- _fileLock . Release ( ) ;
92
+ if ( acquired )
93
+ _fileLock . Release ( ) ;
91
94
}
92
95
}
93
96
You can’t perform that action at this time.
0 commit comments