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

MLPAB-2321: Delete scheduled tasks when CANNOT_REGISTER lpa-updated event received #1640

Merged
merged 15 commits into from
Nov 27, 2024

Conversation

acsauk
Copy link
Contributor

@acsauk acsauk commented Nov 21, 2024

Purpose

Fixes MLPAB-2321

@acsauk
Copy link
Contributor Author

acsauk commented Nov 21, 2024

Some things to think about with scheduled tasks going forward:

  • Ignored tasks won't get rerun with the current implementation. How do we want to handle this going forward?
  • Will we have a retention policy on handled tasks and/or tasks at a certain age? If not, it makes sense to give tasks linked to an LPA with cannot-register a handled (or something) status

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 96.55172% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.83%. Comparing base (b44d4ca) to head (1e13d5d).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
cmd/event-received/lpastore_event_handler.go 83.33% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1640      +/-   ##
==========================================
+ Coverage   94.35%   94.83%   +0.48%     
==========================================
  Files         283      282       -1     
  Lines       15581    15551      -30     
==========================================
+ Hits        14701    14748      +47     
+ Misses        709      632      -77     
  Partials      171      171              
Flag Coverage Δ
unittests 94.83% <96.55%> (+0.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acsauk acsauk marked this pull request as ready for review November 26, 2024 14:02
@acsauk acsauk requested a review from a team as a code owner November 26, 2024 14:02
@acsauk acsauk changed the title MLPAB-2321: Ignore scheduled tasks if LPA status is cannot-register MLPAB-2321: Delete scheduled tasks when CANNOT_REGISTER lpa-upadted event received Nov 26, 2024
@acsauk acsauk changed the title MLPAB-2321: Delete scheduled tasks when CANNOT_REGISTER lpa-upadted event received MLPAB-2321: Delete scheduled tasks when CANNOT_REGISTER lpa-updated event received Nov 26, 2024
internal/dynamo/client.go Outdated Show resolved Hide resolved
@@ -375,6 +399,32 @@ func (c *Client) DeleteOne(ctx context.Context, pk PK, sk SK) error {
return err
}

func (c *Client) DeleteManyByUID(ctx context.Context, keys []Keys, uid string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is any point having uid again, we should be able to trust the previous query

Copy link
Contributor

Choose a reason for hiding this comment

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

so could use DeleteKeys

Copy link
Contributor Author

@acsauk acsauk Nov 26, 2024

Choose a reason for hiding this comment

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

I'd originally used DeleteKeys but then switched to this. I know the likelihood of getting exactly the same timestamp + action type is low but as the keys aren't unique I wanted a failsafe there to be sure we weren't deleting unintended events. If you're comfortable with that risk feel free to drop this while I'm out and just rely on the keys 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

every (PK, SK) is unique, so it won't be an issue. I have spotted Put doesn't use Create, so it would currently overwrite an existing scheduled event, I'm going to change that

@hawx hawx force-pushed the MLPAB-2321-display-cannot-register-and-stop-future-comms branch from 0ba59ba to d7563bd Compare November 27, 2024 09:49
@hawx hawx force-pushed the MLPAB-2321-display-cannot-register-and-stop-future-comms branch from d7563bd to 5675ae5 Compare November 27, 2024 09:50
@hawx hawx merged commit d8b7c61 into main Nov 27, 2024
31 checks passed
@hawx hawx deleted the MLPAB-2321-display-cannot-register-and-stop-future-comms branch November 27, 2024 15:18
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.

2 participants