ironmansoftware / universal-automation

Universal Automation is the PowerShell-first automation platform.
https://ironmansoftware.com/universal-automation/
MIT License
24 stars 4 forks source link

Schedules aren't scheduled right after server start up #127

Closed adamdriscoll closed 4 years ago

adamdriscoll commented 4 years ago

When UA starts up it schedules the jobs with hangfire. I'm noticing an error when starting up and the schedules aren't setup right away.

2020-03-10 07:30:33 [WARN]  (Hangfire.AutomaticRetryAttribute) Failed to process the job 'ada39f27-97aa-42b7-9c29-b69697867d7f': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:19.
System.IO.IOException
The process cannot access the file 'C:\Users\adamr\AppData\Local\UniversalAutomation\database.db' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at LiteDB.FileDiskService.CreateFileStream(String path, FileMode mode, FileAccess access, FileShare share)
   at LiteDB.FileDiskService.Initialize(Logger log, String password)
   at LiteDB.LiteEngine..ctor(IDiskService disk, String password, Nullable`1 timeout, Int32 cacheSize, Logger log, Boolean utcDate)
   at LiteDB.LiteDatabase.<>c__DisplayClass11_0.<.ctor>b__0()
   at LiteDB.LazyLoad`1.get_Value()
   at LiteDB.LiteCollection`1.<Find>d__17.MoveNext()
   at LiteDB.LiteQueryable`1.<ToEnumerable>d__21.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at UniversalAutomation.LiteDBTable`1.ToArray()
   at UniversalAutomation.LiteDBTable`1.Get()
   at UniversalAutomation.JobScheduler.Schedule()

You'll notice the NextExecutionTime is DateTime.MinValue.

adamdriscoll commented 4 years ago

Resolved.