Skip to content
New issue

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

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

Already on GitHub? # to your account

Generic watchdogs infrastructure #3218

Merged
merged 8 commits into from
Apr 13, 2023
Merged

Generic watchdogs infrastructure #3218

merged 8 commits into from
Apr 13, 2023

Conversation

SergeyGaluzo
Copy link
Contributor

@SergeyGaluzo SergeyGaluzo commented Apr 6, 2023

  1. Adds watchdogs infra based on lease paradigm.
  2. Retrofits Defrag to new infra.
  3. Adds new Cleanup watchdog.
  4. Adds tests.

@SergeyGaluzo SergeyGaluzo requested a review from a team as a code owner April 6, 2023 21:19
@SergeyGaluzo SergeyGaluzo added this to the 112 milestone Apr 6, 2023
@SergeyGaluzo SergeyGaluzo added New Feature Label for a new feature in FHIR OSS Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs labels Apr 6, 2023
@microsoft microsoft deleted a comment from azure-pipelines bot Apr 6, 2023
await _defragWatchdog.StartAsync(stoppingToken);
await _cleanupEventLogWatchdog.StartAsync(stoppingToken);

while (true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this loop needed? Once the watchdogs are started does this method need to keep running?

Copy link
Contributor Author

@SergeyGaluzo SergeyGaluzo Apr 10, 2023

Choose a reason for hiding this comment

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

I don't know for sure. It depends on what will happen when background service completes. Will it be GCed together with watchdogs it is holding?

(
Watchdog varchar(100) NOT NULL
,LeaseHolder varchar(100) NOT NULL CONSTRAINT DF_WatchdogLeases_LeaseHolder DEFAULT ''
,LeaseEndTime datetime NOT NULL CONSTRAINT DF_WatchdogLeases_LeaseEndTime DEFAULT 0
Copy link
Member

Choose a reason for hiding this comment

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

Should timers record when the last instance was executed? This would give you something to resume from is something happened to the original process

Copy link
Contributor Author

@SergeyGaluzo SergeyGaluzo Apr 10, 2023

Choose a reason for hiding this comment

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

In general case, the state of the abandoned process cannot be determined by its last success date. It might be useful in certain cases, but not generic... Also leasing goes on different intervals than execution

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't guarantee that a timer will be run at a regular interval though. Timers that are run less often could more likely be impacted by abandoned processes, or be subject to running at more or less frequent intervals than intended

Copy link
Contributor Author

@SergeyGaluzo SergeyGaluzo Apr 11, 2023

Choose a reason for hiding this comment

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

That is true. Watchdogs with long periods can be affected. I don't think that this behavior requires fixing though. For example for defrag and cleanup watchdogs it does not matter.

LTA-Thinking
LTA-Thinking previously approved these changes Apr 11, 2023
@LTA-Thinking
Copy link
Contributor

@brendankowitz I think something is wrong with the metadata validation. This PR has the New Feature tag, but the validation is saying it is missing that type of tag.

@LTA-Thinking LTA-Thinking added the Enhancement Enhancement on existing functionality. label Apr 11, 2023
@LTA-Thinking
Copy link
Contributor

I'm adding the enhancement tag as it is the next best fit.

@SergeyGaluzo SergeyGaluzo merged commit 1143cf5 into main Apr 13, 2023
@SergeyGaluzo SergeyGaluzo deleted the users/sergal/watchdogs branch April 13, 2023 19:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Enhancement Enhancement on existing functionality. New Feature Label for a new feature in FHIR OSS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants