Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: schedule scan based on queue events #128

Merged
merged 4 commits into from
Jun 13, 2024
Merged

feat: schedule scan based on queue events #128

merged 4 commits into from
Jun 13, 2024

Conversation

csmig
Copy link
Member

@csmig csmig commented Jun 11, 2024

Resolves #117

Alternative approach to #127 that:

  • schedules the next scan with a delay relative to the last worker of the current processing pipeline.
  • avoids non-productive invocations of startScanner() by only scheduling when workers are finished

Copy link
Collaborator

@cd-rite cd-rite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to remove the call to startScanner() on line 367 in onAlarmLowered()
(Or rather, make it a call to testScheduleNextScan() instead)

@csmig
Copy link
Member Author

csmig commented Jun 12, 2024

Agree that startScanner() should not be called on alarmLowered. Disagree that testScheduleNextScan() is the best replacement. I think scan scheduling should not be directly modified in alarm handling at all.

Instead, I've updated the alarm handlers to pause parseQueue and cargoQueue on alarmRaised and resume them on alarmLowered. This has the effect of stopping work when an alarm condition occurs and resuming work when and if the alarm condition is resolved. It indirectly affects scan scheduling since the next scan is only scheduled when both queues have no work remaining.

The alarm handling in this PR is a transitional implementation because overall alarm handling code is to be addressed while working #121 . I expect to be moving alarm handling code into the individual queue modules since there is common behavior in both scan and events mode.

@csmig csmig requested a review from cd-rite June 12, 2024 13:27
Copy link

Quality Gate Passed Quality Gate passed for 'NUWCDIVNPT_stigman-watcher'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@csmig csmig merged commit 431d2bd into main Jun 13, 2024
3 checks passed
@csmig csmig deleted the scan-schedule-events branch June 13, 2024 00:54
@cd-rite cd-rite mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scans should not run concurrently, and should only run when no files are currently being processed.
2 participants