-
Notifications
You must be signed in to change notification settings - Fork 71
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
restructure storage, improve task run logic, fixed #441 #446
Conversation
d46b6b2
to
b79b5e0
Compare
b79b5e0
to
87d11aa
Compare
87d11aa
to
fbd7242
Compare
@@ -392,10 +403,12 @@ pub mod pallet { | |||
who: AccountOf<T>, | |||
task_id: TaskId, | |||
}, | |||
Notify { | |||
message: Vec<u8>, | |||
}, | |||
TaskNotFound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What’re the differences between TaskDoesNotExsit and TaskNotFound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the usages are similar I suggest to merge them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is overlook. They are just same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are actually a bit different. One is Error, one is an Event.
Error: used when cancel task, if task id not found, we return an error
Event: used when processing task, if a task id not found, we emit an event and continue to normal execution to process other task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, yeah if they are at difference places, I don’t think we’ll mix them up with the same name. The change looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@chrisli30 code update and comment is added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -392,10 +403,12 @@ pub mod pallet { | |||
who: AccountOf<T>, | |||
task_id: TaskId, | |||
}, | |||
Notify { | |||
message: Vec<u8>, | |||
}, | |||
TaskNotFound { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, yeah if they are at difference places, I don’t think we’ll mix them up with the same name. The change looks good.
Improvement over chain storage and underlying data structure, public API of extrinsisc remain unchange.
Changes include:
Refactor Storage
removed AccountTasks
remove ScheduledAssetDeletion
updated Tasks to (account_id, task_id)
add TaskStats and AccountStat to track task count
Task Execution:
Handle task expiration or price moved skipped.
If task has expired by the time it got run, we won't run it,
if price moved by the time the task run, we wo't run it either
Task Scheduling
Introduce MaxTaskPerAccount and MaxTaskOverall limit.