new job changes#14
Conversation
Qodana for JVMIt seems all right 👌 No new problems were found according to the checks applied ☁️ View the detailed Qodana report Contact Qodana teamContact us at qodana-support@jetbrains.com
|
There was a problem hiding this comment.
Pull request overview
Adds a new “JSA Activity Mode” background job/category intended to periodically mark random unchecked jobs as unsuitable (to simulate job-search activity) when running in LocalMode.
Changes:
- Introduces
JobCategory.JsaActivityand a newJsaActivityModeJobscheduled viaLocalBackgroundService. - Updates the Background Jobs UI to show the new category icon and job description.
- Updates portable build ZIP LFS pointers.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Services/LocalBackgroundService.cs | Adds new job default/category and conditionally schedules the new job loop in LocalMode. |
| Services/JsaActivityModeJob.cs | Implements the long-running “JSA Activity Mode” job logic. |
| Components/Pages/BackgroundJobs.razor | Adds icon + description text for the new category/job. |
| Portable/JobTracker-x86.zip.001 | Updates Git LFS pointer for portable artifact part. |
| Portable/JobTracker-x86.zip.002 | Updates Git LFS pointer for portable artifact part. |
| Portable/JobTracker-x64.zip.001 | Updates Git LFS pointer for portable artifact part. |
| Portable/JobTracker-x64.zip.002 | Updates Git LFS pointer for portable artifact part. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private async Task RunJsaActivityMode() | ||
| { | ||
| using var scope = _scopeFactory.CreateScope(); | ||
| var job = scope.ServiceProvider.GetRequiredService<JsaActivityModeJob>(); | ||
| await job.RunAsync(); |
There was a problem hiding this comment.
RunJsaActivityMode resolves JsaActivityModeJob from DI, but the job is not registered in Program.cs (no AddTransient/AddScoped entry). This will throw at runtime the first time the loop runs. Register JsaActivityModeJob in the service container the same way other background jobs are registered.
| if (_jsaActivityEnabled) | ||
| tasks = [.. tasks, RunLoop("JsaActivityMode", RunJsaActivityMode, stoppingToken)]; | ||
|
|
There was a problem hiding this comment.
JsaActivityModeJob supports cancellation via CancellationToken, but RunLoop/RunJsaActivityMode don’t pass the stoppingToken through, meaning the host may be unable to shut down promptly (this job can run up to 4 hours). Consider updating RunLoop to accept a token-aware delegate (e.g., Func<CancellationToken, Task>) and call job.RunAsync(ct) so shutdown cancels the session.
| _configPath = Path.Combine(env.ContentRootPath, "Data", "background-jobs.json"); | ||
|
|
||
| // JSA Activity Mode is only available when the data directory contains "passp" | ||
| _jsaActivityEnabled = _configPath.Contains("passp", StringComparison.OrdinalIgnoreCase); | ||
|
|
There was a problem hiding this comment.
Feature-gating via _configPath.Contains("passp") is brittle and can enable/disable the job based on an incidental substring in the install path. If this is meant to be a controllable feature flag, prefer an explicit config setting (appsettings/env var) or a dedicated marker file in the Data directory; also the comment says “data directory” but the check is on the full config file path.
| _configPath = Path.Combine(env.ContentRootPath, "Data", "background-jobs.json"); | |
| // JSA Activity Mode is only available when the data directory contains "passp" | |
| _jsaActivityEnabled = _configPath.Contains("passp", StringComparison.OrdinalIgnoreCase); | |
| var dataDirectory = Path.Combine(env.ContentRootPath, "Data"); | |
| _configPath = Path.Combine(dataDirectory, "background-jobs.json"); | |
| // JSA Activity Mode is only available when the Data directory contains the explicit marker file. | |
| _jsaActivityEnabled = File.Exists(Path.Combine(dataDirectory, "jsa-activity.enabled")); |
| } | ||
|
|
||
| var pick = browseJobs[random.Next(browseJobs.Count)]; | ||
| jobService.SetSuitabilityStatus(pick.Id, SuitabilityStatus.Unsuitable, HistoryChangeSource.Manual, |
There was a problem hiding this comment.
This job changes suitability automatically but records the history source as Manual, which can make the audit trail misleading (it will look like a user action). Consider using HistoryChangeSource.System (or a dedicated source) so downstream views/reports can distinguish automated activity from real user clicks.
| jobService.SetSuitabilityStatus(pick.Id, SuitabilityStatus.Unsuitable, HistoryChangeSource.Manual, | |
| jobService.SetSuitabilityStatus(pick.Id, SuitabilityStatus.Unsuitable, HistoryChangeSource.System, |
No description provided.