pieceofsummer / Hangfire.Console

Job console extension for Hangfire
MIT License
435 stars 80 forks source link

Monitoring API not pulling any data #117

Open DSCmattb opened 2 years ago

DSCmattb commented 2 years ago

I'm running SQL 2016 as the storage and can see in the Set table console logs for example Key "console:61a3d4c0e711404025"

I can also confirm in the Hash table these are correct, however when running the code with the correct JobId as mentioned in your previous issues the following sql is run.

exec sp_executesql N' select * from [HangFire].Job with (nolock, forceseek) where Id = @id select * from [HangFire].JobParameter with (nolock, forceseek) where JobId = @id select * from [HangFire].State with (nolock, forceseek) where JobId = @id order by Id desc',N'@id nvarchar(4000)',@id=N'1404026'

This renders the correct data for the job and I can confirm this is the only job in the database (test environment)

The next is the request to find the Set information which renders an incorrect console:

exec sp_executesql N'select count(*) from [HangFire].[Set] with (readcommittedlock, forceseek) where [Key] = @key',N'@key nvarchar(4000)',@key=N'console:df6915c0e711404026'

The Hangfire Job Server is running in a standalone application and process, processing the job queues. The application pulling the data for display is a separate process also. I can confirm all of the other data is pulled correctly from the monitoring api. Both application have UseConsole set.

DSCmattb commented 2 years ago

I've done a bit more research today, it seems that the timestamp provided to ConsoleId is different to the one persisted in SQL. Only marginally different but, enough to cause the timestamps to calculate a different ConsoleId. For example, the breakpoint when the code runs provides 2021-12-31 07:25:58.502137, in SQL 2021-12-31 07:25:58.593. I would assume the 91ms would cause that kind of issue, right?