fix: configurable Cron schedules, refs NOISSUE
This commit is contained in:
		@@ -33,6 +33,13 @@ public class AppConfiguration
 | 
			
		||||
            CrewGroup = $"cn={userGroupName},ou=groups,dc=disi,dc=dev",
 | 
			
		||||
            ManagerGroup = $"cn={managersGroupName},ou=groups,dc=disi,dc=dev"
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        this.UserCheckTimerSchedule = Environment.GetEnvironmentVariable("USER_CHECK_TIMER_SCHEDULE") ?? "*/1 * * * *";
 | 
			
		||||
        this.LikePlaylistCheckTimerSchedule = Environment.GetEnvironmentVariable("LIKE_PLAYLIST_CHECK_TIMER_SCHEDULE") ?? "*/10 * * * *";
 | 
			
		||||
        this.UserIntroCheckTimerSchedule = Environment.GetEnvironmentVariable("USER_INTRO_TIMER_SCHEDULE") ?? "*/1 * * * *";
 | 
			
		||||
        this.PickOfTheDayCheckTimerSchedule = Environment.GetEnvironmentVariable("PICK_OF_THE_DAY_TIMER_SCHEDULE") ?? "0 8 * * *";
 | 
			
		||||
        this.LdapAssociationTimerSchedule = Environment.GetEnvironmentVariable("LDAP_ASSOCIATION_TIMER_SCHEDULE") ?? "*/10 * * * *";
 | 
			
		||||
        this.MessageSyncTimerSchedule = Environment.GetEnvironmentVariable("MESSAGE_SYNC_TIMER_SCHEDULE") ?? "*/10 * * * *";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string SignalAPIEndpointUri
 | 
			
		||||
@@ -109,4 +116,34 @@ public class AppConfiguration
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string UserCheckTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string LikePlaylistCheckTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string UserIntroCheckTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string PickOfTheDayCheckTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string LdapAssociationTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string MessageSyncTimerSchedule
 | 
			
		||||
    {
 | 
			
		||||
        get; private set;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -32,7 +32,7 @@ var app = builder.Build();
 | 
			
		||||
var logger = app.Logger;
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up user check timer");
 | 
			
		||||
var userCheckTimer = new CronTimer("*/1 * * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var userCheckTimer = new CronTimer(AppConfiguration.Instance.UserCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
userCheckTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var signalIntegration = app.Services.GetService<SignalIntegration>();
 | 
			
		||||
@@ -72,7 +72,7 @@ userCheckTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up liked songs playlist creation timer");
 | 
			
		||||
var likePlaylistCheckTimer = new CronTimer("*/30 * * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var likePlaylistCheckTimer = new CronTimer(AppConfiguration.Instance.LikePlaylistCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var spotifyApiClient = app.Services.GetService<SpotifyApiClient>();
 | 
			
		||||
@@ -109,7 +109,7 @@ likePlaylistCheckTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up user intro timer");
 | 
			
		||||
var userIntroTimer = new CronTimer("*/1 * * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var userIntroTimer = new CronTimer(AppConfiguration.Instance.UserIntroCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
userIntroTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var dci = DataContext.Instance;
 | 
			
		||||
@@ -138,7 +138,7 @@ userIntroTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up pick of the day timer");
 | 
			
		||||
var pickOfTheDayTimer = new CronTimer("0 8 * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var pickOfTheDayTimer = new CronTimer(AppConfiguration.Instance.PickOfTheDayCheckTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
pickOfTheDayTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var dci = DataContext.Instance;
 | 
			
		||||
@@ -212,7 +212,7 @@ var startUserAssociationProcess = async (User userToAssociate) =>
 | 
			
		||||
};    
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up LdapAssociation timer");
 | 
			
		||||
var ldapAssociationTimer = new CronTimer("*/10 * * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var ldapAssociationTimer = new CronTimer(AppConfiguration.Instance.LdapAssociationTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
ldapAssociationTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var dci = DataContext.Instance;
 | 
			
		||||
@@ -241,7 +241,7 @@ ldapAssociationTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
logger.LogTrace("Setting up MessageSync timer");
 | 
			
		||||
var messageSyncTimer = new CronTimer("*/10 * * * *", "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
var messageSyncTimer = new CronTimer(AppConfiguration.Instance.MessageSyncTimerSchedule, "Europe/Vienna", includingSeconds: false);
 | 
			
		||||
messageSyncTimer.OnOccurence += async (s, ea) =>
 | 
			
		||||
{
 | 
			
		||||
    var signalIntegration = app.Services.GetService<SignalIntegration>();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user