File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
src/Infrastructure/BotSharp.Core.Crontab/Services Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,22 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
3131
3232 while ( ! stoppingToken . IsCancellationRequested )
3333 {
34- var isLocked = await locker . LockAsync ( DIST_KEY , async ( ) =>
34+ try
3535 {
36- await RunCronChecker ( scope . ServiceProvider ) ;
37- await Task . Delay ( 1000 , stoppingToken ) ;
38- } ) ;
39-
40- if ( ! isLocked )
41- {
42- await Task . Delay ( 1000 , stoppingToken ) ;
36+ var isLocked = await locker . LockAsync ( DIST_KEY , async ( ) =>
37+ {
38+ await RunCronChecker ( scope . ServiceProvider ) ;
39+ await Task . Delay ( 1000 , stoppingToken ) ;
40+ } ) ;
41+ if ( ! isLocked )
42+ {
43+ await Task . Delay ( 1000 , stoppingToken ) ;
44+ }
45+ }
46+ catch ( Exception ex )
47+ {
48+ _logger . LogWarning ( $ "Crontab Watcher background service error: { ex . Message } ") ;
49+ await Task . Delay ( 3000 , stoppingToken ) ;
4350 }
4451 }
4552
You can’t perform that action at this time.
0 commit comments