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

fix(shutdown): is_triggered returns up-to-date value without first polling #5997

Merged

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Nov 30, 2023

Description

fix: always return correct value from is_triggered without first requiring the signal to be polled

Motivation and Context

OneshotSignal uses the futures::Shared<Fut> combinator to allow a single future to be cloned and awaited on in multiple places. Previously we used FuseFuture::is_terminated to determine if the signal is triggered. However the semantics of is_terminated and is_triggered are subtly different. is_terminated indicates whether a future should be polled again, which is true even if the trigger has fired.

This PR uses an AtomicBool that is set to true at the time the trigger is fired so that polling first is not required.

Thanks to @hansieodendaal for discovering this issue

How Has This Been Tested?

Updated existing test to check is_triggered, previously failed and now passes.

What process can a PR reviewer use to test or verify this change?

N/A

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Nov 30, 2023
@sdbondi sdbondi force-pushed the shutdown-fix-is-trigger branch from 3e9dfaf to 788ad13 Compare November 30, 2023 07:38
Copy link

Test Results (CI)

1 259 tests   1 259 ✔️  11m 14s ⏱️
     39 suites         0 💤
       1 files           0

Results for commit 788ad13.

@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label Nov 30, 2023
Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

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

ACK

Nice

Copy link

Test Results (Integration tests)

14 tests  +14   14 ✔️ +14   3m 52s ⏱️ + 3m 52s
  2 suites +  2     0 💤 ±  0 
  2 files   +  2     0 ±  0 
  1 errors

For more details on these parsing errors, see this check.

Results for commit 788ad13. ± Comparison against base commit 6723dc7.

@SWvheerden SWvheerden merged commit 49f2053 into tari-project:development Nov 30, 2023
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants