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/159/autodeposit #179

Closed
wants to merge 18 commits into from
Closed

Feat/159/autodeposit #179

wants to merge 18 commits into from

Conversation

Mikelle
Copy link
Member

@Mikelle Mikelle commented Jun 28, 2024

Closing those issues:
#159
#154

@Mikelle Mikelle requested a review from aloknerurkar June 28, 2024 00:25
@Mikelle Mikelle self-assigned this Jun 28, 2024
@shaspitz
Copy link
Contributor

Failing ci is likely unrelated to this branch and should be fixed by #181

}

func (adt *AutoDepositTracker) DoAutoMoveToAnotherWindow(ctx context.Context, ads []*bidderapiv1.AutoDeposit) error {
adt.isWorking.Store(true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should check first if it is already working before starting a new one right?

Probably need to use something like CAS instead of Store.

return fmt.Errorf("error subscribing to event: %w", err)
}

eg.Go(func() error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This separate goroutine is not needed. We can move this functionality to the goroutine below itself.

}

func (adt *AutoDepositTracker) Stop() (*bidderapiv1.CancelAutoDepositResponse, error) {
if !adt.isWorking.Load() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its better to have mutex here. We should not allow Stop to go through before the autodeposit is properly started. This flag doesnt really mean it was started properly as it is set in the start of the function.

There could be a race condition here where the cancelFunc is not set and stop returns deposits to cancel and says it has stopped the autodeposit process when in reality it hasnt.

@Mikelle Mikelle force-pushed the feat/159/autodeposit branch from 7236481 to c49dda6 Compare July 8, 2024 16:04
@Mikelle Mikelle requested a review from aloknerurkar July 8, 2024 17:00
@Mikelle Mikelle closed this Jul 9, 2024
@Mikelle Mikelle deleted the feat/159/autodeposit branch July 29, 2024 15:37
@Mikelle Mikelle restored the feat/159/autodeposit branch July 29, 2024 15:37
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.

3 participants