Fixed timer bug
This commit is contained in:
		@@ -8,7 +8,7 @@ using Telegram.Bot.Types.Enums;
 | 
			
		||||
 | 
			
		||||
public class MastodonBot
 | 
			
		||||
{
 | 
			
		||||
    private static Timer _timer;
 | 
			
		||||
    private static Timer _postFetchTimer, _backupTimer;
 | 
			
		||||
 | 
			
		||||
    private static async Task Main()
 | 
			
		||||
    {
 | 
			
		||||
@@ -84,9 +84,9 @@ public class MastodonBot
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Set a timer to fetch and process posts every 15 minutes
 | 
			
		||||
        _timer = new Timer(async _ => await RunCheck.runAsync(db, bot, config.TAG, logger, config.INSTANCE), null, TimeSpan.Zero, TimeSpan.FromMinutes(15));
 | 
			
		||||
        _postFetchTimer = new Timer(async _ => await RunCheck.runAsync(db, bot, config.TAG, logger, config.INSTANCE), null, TimeSpan.Zero, TimeSpan.FromMinutes(15));
 | 
			
		||||
        // Another timer to automatically backup the DB every 1 hour
 | 
			
		||||
        _timer = new Timer(async _ => await HandleDbBackup.HandleDbBackupAsync(bot, logger, config.DB_NAME, config.ADMIN_NUMID, db), null, TimeSpan.Zero, TimeSpan.FromHours(1));
 | 
			
		||||
        _backupTimer = new Timer(async _ => await HandleDbBackup.HandleDbBackupAsync(bot, logger, config.DB_NAME, config.ADMIN_NUMID, db), null, TimeSpan.Zero, TimeSpan.FromHours(1));
 | 
			
		||||
        // Keep the bot running
 | 
			
		||||
        await Task.Delay(-1);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user