yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
634 stars 186 forks source link

No tags populated #214

Open donnytian opened 6 months ago

donnytian commented 6 months ago

Followed the steps in the wiki to use HttpJob along with Tags, and observed that tags are not populated for JobAgent.

services.AddHangfire(config => config
  .UseSqlServerStorage(...)
  .UseConsole(...)
  .UseHangfireHttpJob(...)
  .UseTagsWithSql(...);

By checking the CodingUtil.IsTagServiceInstalled it returns false, it's a static file and was initialized earlier than expected.

The workaround is to add Tags before the HttpJob:

services.AddHangfire(config => config
  .UseSqlServerStorage(...)
  .UseConsole(...)
  // Add Tags before HttpJob, otherwise HttpJob won't generate tags for its jobs.
  .UseTagsWithSql(...)
  .UseHangfireHttpJob(...);

To fix this issue, change CodingUtil.IsTagServiceInstalled a property should be fine.

yuzd commented 3 months ago

thank you , i will fix it