Skip to content

fix multiple tasks coexists at same time when rescheduled. #136

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

Merged
merged 11 commits into from
Aug 23, 2023

Conversation

pxp9
Copy link
Collaborator

@pxp9 pxp9 commented Aug 22, 2023

I have been working with fang and I have noticed that it is a small period of time that two exactly equal tasks can live at the same time,

In order to fix this i have just reorder the code to

First execute task

then reschedule the task.

This way when a task is runned and the RetentionMode is set to remove it when it is finished, the task will be removed before it is reschedule the new task.

@pxp9 pxp9 requested review from ayrat555 and Dopplerian August 22, 2023 08:11
Copy link
Collaborator

@Dopplerian Dopplerian left a comment

Choose a reason for hiding this comment

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

Is there a way of writing a test to detect this? It would be good to prevent it from being reintroduced in the future.

@pxp9
Copy link
Collaborator Author

pxp9 commented Aug 23, 2023

I think there is no way to test this because it is done atomically.

Maybe it one way to do it but i am not sure.

It can be done a method that will request the number of tasks between the task is executing and it is scheduled.

Let me try it.

@pxp9
Copy link
Collaborator Author

pxp9 commented Aug 23, 2023

Is there a way of writing a test to detect this? It would be good to prevent it from being reintroduced in the future.

no schedule until run test

this async test wont work will be stuck to infinite if the beahviour is changed.

@pxp9
Copy link
Collaborator Author

pxp9 commented Aug 23, 2023

Is there a way of writing a test to detect this? It would be good to prevent it from being reintroduced in the future.

no schedule until run test

this async test wont work will be stuck to infinite if the beahviour is changed.

i dont know how to set a timeout

@pxp9 pxp9 requested a review from ayrat555 August 23, 2023 09:33
@pxp9 pxp9 requested a review from Dopplerian August 23, 2023 09:55
@pxp9
Copy link
Collaborator Author

pxp9 commented Aug 23, 2023

Is there a way of writing a test to detect this? It would be good to prevent it from being reintroduced in the future.

no schedule until run test
this async test wont work will be stuck to infinite if the beahviour is changed.

i dont know how to set a timeout

this test does not seem to be consistant, the only way is consistant is that it will be stuck if the task is scheduled before runned.

Dopplerian
Dopplerian previously approved these changes Aug 23, 2023
@Dopplerian Dopplerian dismissed their stale review August 23, 2023 14:53

Ignored tests seem to not be working right now.

Copy link
Collaborator

@Dopplerian Dopplerian left a comment

Choose a reason for hiding this comment

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

The blocking::worker::worker_tests::executes_task_only_of_specific_type seems to be failing under specific circumstances on my machine. I'd be thankful if someone confirmed they had the same problem. The commands I run are the following:

make db
make diesel
git restore fang/src/blocking/schema.rs
make tests
make ignored

The test seems to only fail if both git restore and make tests are run.

I use git restore because make diesel adds a #[max_length = 64] line in fang/src/blocking/schema.rs right above uniq_hash -> Nullable<Bpchar>,.

@pxp9
Copy link
Collaborator Author

pxp9 commented Aug 23, 2023

yeap make diesel is broken in this branch but in master is fine.

change task type of test

this commit should fix your issue when running ignored tests.

@pxp9 pxp9 requested a review from Dopplerian August 23, 2023 15:30
Copy link
Collaborator

@Dopplerian Dopplerian left a comment

Choose a reason for hiding this comment

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

LGTM

@pxp9 pxp9 merged commit e2ccfc9 into master Aug 23, 2023
@pxp9 pxp9 deleted the fix/multiple_scheduled_task branch August 23, 2023 16:06
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