Closed wsl2001 closed 8 months ago
@wsl2001 Are you using SQL persistence?
No am using liteDB
LiteDB and SQLite do not currently persist One-Time schedules during a restarted because they are using Hangfire's in-memory persistence queue. Only SQL (on soon PostgreSQL) currently persists one-time schedules across restarts.
how it was working on PSU 3.10.2 with same LIteDB? Schedule.ps1 usually created with script code inside no problem and will remain there.
I have installed sql express and completed the configuration of psu to use sql by updating appsettings.json file with required sql info and did migrate the data using the included migration tool and re test and still same issue using sql this time if i recycle app pool the schedule is gone.
Also i need to mention if i added the schedule code in schedules.ps1 file then the schedule will retain after appPool recycle so currently only one-time schedule is broken no matter if you use admin console or script code it will not create the schedules.ps1 under repository folder and will just show the schedule in admin consle but it will disappear after appPool recycle were other options like cron it works just fine but the problem is with one-time schedule even if you dont recycle apppool at some point you have to apply windows updates which you will need to reboot the server and then any one-time schedule created will be gone. i have tried fresh installation of psu and used sql server and same results.
I see why this is happening. While the job is still scheduled in hangfire, it has been "removed" from PSU because the service was restarted. We added a check to avoid running scheduled jobs that have been removed that has caused this. We should be loading this schedule on startup to avoid this and to make sure it displays in the admin console and not just hangfire.
Version
4.2.12
Severity
Critical
Steps to Reproduce
Creating a onetime schedule for a script is not retaining after rebooting the machine or when recycle IIS AppPool aslo the schedule.ps1 that PSU should create in repository is not getting created. last working version of PSU checked that retain onetime schedule is PSU 3.10.2
Expected behavior
Actual behavior
Additional Environment data
Windows server 2022 hosted in aws Powershell Universal version 4.2.12 hosted in IIS posted in ironman software forum as well https://forums.ironmansoftware.com/t/script-onetime-schedule-disappear-when-stop-start-psu-apppool-in-iis-using-psu-4-2-12/10371/1
Visuals