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

Add support of async execution #5

Open
ziflex opened this issue May 24, 2020 · 0 comments
Open

Add support of async execution #5

ziflex opened this issue May 24, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ziflex
Copy link
Member

ziflex commented May 24, 2020

We need to add possibility execute queries asynchronously i.e. not blocking HTTP request.

The design is pretty simple:

  • Add [POST] /async (or other name, naming is hard :)) method that receives similar payload to [POST] / with additional property .callback that represents a valid URL (we need to validate it before responding):
type AsyncScript struct {
    Script
    Callback string `json: "callback"`
}
  • If everything is ok, the output must be an uuid value representing a job ID.
  • Once Worker received an async payload, it schedules it internally using thread-pool.
  • When Worker is done with a job, whether it failed or not, it should call a given callback url with a following payload
type AsyncResult struct {
    Status string // succeeded or failed
    Data byte[] // script result or error
}
@ziflex ziflex added the enhancement New feature or request label May 24, 2020
@ziflex ziflex mentioned this issue May 24, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants