Skip to content

Commit f5e6d85

Browse files
nikolajlauridsenclaudeCopilot
authored
Distributed Background Jobs: Add initialization logging to DistributedJobService (#21112)
* Distributed Background Jobs: Add initialization logging to DistributedJobService 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Use registered instead of intitialized * Update src/Umbraco.Infrastructure/Services/Implement/DistributedJobService.cs Co-authored-by: Copilot <[email protected]> * Be consistent in log messages --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 1a4ca0b commit f5e6d85

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Umbraco.Infrastructure/Services/Implement/DistributedJobService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,15 @@ public async Task FinishAsync(string jobName)
115115
/// <inheritdoc />
116116
public async Task EnsureJobsAsync()
117117
{
118+
_logger.LogInformation("Registering distributed background jobs");
119+
118120
// Pre-compute registered job data outside the lock to minimize lock hold time
119121
var registeredJobsByName = _distributedBackgroundJobs.ToDictionary(x => x.Name, x => x.Period);
120122

121123
// Early exit if no registered jobs
122124
if (registeredJobsByName.Count is 0)
123125
{
126+
_logger.LogInformation("No distributed background jobs to register");
124127
return;
125128
}
126129

@@ -157,6 +160,8 @@ public async Task EnsureJobsAsync()
157160
LastAttemptedRun = utcNow,
158161
});
159162
}
163+
164+
_logger.LogInformation("Registered distributed background job {JobName}, running every {Period}", registeredJob.Key, registeredJob.Value);
160165
}
161166

162167
// Batch insert new jobs
@@ -176,5 +181,7 @@ public async Task EnsureJobsAsync()
176181
}
177182

178183
scope.Complete();
184+
185+
_logger.LogInformation("Completed registering distributed background jobs");
179186
}
180187
}

0 commit comments

Comments
 (0)