Exemple #1
0
        public async Task ReloadContainerCache()
        {
            await Context.Channel.SendMessageAsync("**[Admin]** OK, reloading ContainerCache");

            ContainerCache.Dispose();
            ContainerCache.Initialize(Program.LOCAL_CONTAINER_CACHE_DIRECTORY);
        }
        protected override async Task RunAppSpecificBootTasks()
        {
            // Create the cache directories if needed
            System.IO.Directory.CreateDirectory(Program.LOCAL_CONTAINER_CACHE_DIRECTORY);
            System.IO.Directory.CreateDirectory(Program.LOCAL_COMMON_CACHE_DIRECTORY);

            // Initialize the ContainerCache
            ContainerCache.Initialize(Program.LOCAL_CONTAINER_CACHE_DIRECTORY);

            await Task.FromResult(0);

            /*await DiscordBot.LoggingChannel.SendMessageAsync($"**[BootHousekeepingJob]** Scheduling archivals");
             *
             * // Archive all Container pages in production mode
             * if (Configuration.LoadedConfiguration.IsProduction)
             * {
             *  // Declare the minutes offset to stagger the archival jobs
             *  int minutesOffset = 1;
             *
             *  // Get the current DateTime in UTC
             *  DateTime nowTime = DateTime.UtcNow;
             *
             *  async Task ScheduleArchivalIfEligible(Nintendo.SmashUltimate.Bcat.Container container)
             *  {
             *      // Check if the Container's page is active
             *      if (container.StartDateTime < nowTime && container.EndDateTime > nowTime)
             *      {
             *          // Schedule the Job
             *          if (await ContainerArchivalHandler.ScheduleArchival(container, nowTime.AddMinutes(minutesOffset)))
             *          {
             *              // Increment the minutes
             *              minutesOffset++;
             *          }
             *      }
             *  }
             *
             *  // Schedule for all PopUpNews and Events
             *  foreach (PopUpNews popUpNews in ContainerCache.GetPopUpNews())
             *  {
             *      await ScheduleArchivalIfEligible(popUpNews);
             *  }
             *
             *  foreach (Event smashEvent in ContainerCache.GetEvents())
             *  {
             *      await ScheduleArchivalIfEligible(smashEvent);
             *  }
             * }*/
        }