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

Task hooks #77

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Task hooks #77

wants to merge 13 commits into from

Conversation

ismellike
Copy link
Collaborator

@ismellike ismellike commented Oct 7, 2024

Closes #76

Adds a new mock-hook-consumer contract to test out all the of the different task hooks.

Adds a test in the task-queue contract to use the mock-hook-consumer.

  • The test here is using the open payment config to allow the mock-hook-consumer to create a new task when a task is completed
  • When a task is created, the mock-hook-consumer is simply incrementing its created counter.
  • When a task is timed out, the mock-hook-consumer will error out, but the error will be handled correctly by the task-queue to prevent blocking.
  • When a task is completed, the mock-hook-consumer will create a new task based on the given task's result. (square the square)

@ismellike ismellike changed the title Progress on task hooks Task hooks Oct 8, 2024
@ismellike ismellike marked this pull request as ready for review October 8, 2024 20:42
Copy link
Collaborator

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

Good and clean example of how to implement hooks.
Depending on the level of devs who are supposed to read from that example, you might want to explicitely mention in the readme that the cw-minus hook's interface is being used here (if that's not obvious :) ).

contracts/mock-hook-consumer/Cargo.toml Show resolved Hide resolved
contracts/task-queue/src/tests/common.rs Outdated Show resolved Hide resolved
contracts/mock-hook-consumer/src/contract.rs Show resolved Hide resolved
Base automatically changed from staging to main October 11, 2024 07:20
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