Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Scheduler #5374

Closed
wants to merge 14 commits into from
Closed

Scheduler #5374

wants to merge 14 commits into from

Conversation

gavofyork
Copy link
Member

Scheduler to allow for dispatchables to be called in the future without being concerned about using on_initialize.

@gavofyork gavofyork added the A3-in_progress Pull request is in progress. No review needed at this stage. label Mar 23, 2020
@xlc
Copy link
Contributor

xlc commented Mar 23, 2020

We have implemented something very similar https://github.com/laminar-protocol/open-runtime-module-library/blob/master/schedule-update/src/lib.rs

frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
@gavofyork gavofyork added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 24, 2020
@gavofyork
Copy link
Member Author

We have implemented something very similar https://github.com/laminar-protocol/open-runtime-module-library/blob/master/schedule-update/src/lib.rs

Very similar indeed. Though it seems yours is more specialised towards working with extrinsics allowing e.g. signed origins to delay a dispatch until later, whereas this is purely for internal APIs.

frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
gavofyork and others added 7 commits March 25, 2020 10:46
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Comment on lines 184 to 186
/// Cancel a periodic dispatch. If called during its dispatch, it will not be dispatched
/// any further. If called between dispatches, the next dispatch will happen as scheduled but
/// then it will cease.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Cancel a periodic dispatch. If called during its dispatch, it will not be dispatched
/// any further. If called between dispatches, the next dispatch will happen as scheduled but
/// then it will cease.
/// Cancel a periodic dispatch.
///
/// If called during its dispatch, it will not be dispatched
/// any further. If called between dispatches, the next dispatch will happen as scheduled but
/// then it will cease.

1 => {
Self::schedule(when, priority, call);
0
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
},

let s = Scheduled { priority, call, maybe_periodic: Some(index) };
Agenda::<T>::append_or_insert(when, &[s][..]);
index
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
},

@NikVolf
Copy link
Contributor

NikVolf commented Mar 25, 2020

s/2.0.0-alpha.4/2.0.0-alpha.5

but I am not sure if there will be any difference besides aestetic

@gavofyork gavofyork added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels Mar 25, 2020
type Call: Parameter + Dispatchable<Origin=<Self as Trait>::Origin> + GetDispatchInfo;

/// The maximum weight that may be scheduled per block for any dispatchables of less priority
/// than 255.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// than 255.
/// than `HARD_DEADLINE`.

@gavofyork
Copy link
Member Author

Superseded by #5412

@gavofyork gavofyork closed this Mar 26, 2020
@gavofyork gavofyork added this to Done in Runtime via automation Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants