Skip to content

Add support of async execution #5

@ziflex

Description

@ziflex

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
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions