long-running-task

Crates.iolong-running-task
lib.rslong-running-task
version0.1.1
sourcesrc
created_at2024-04-29 10:23:42.194878
updated_at2024-04-29 12:24:20.317705
descriptionHandle long-running tasks for your RESTful HTTP API
homepage
repositoryhttps://github.com/thomas-zahner/long-running-task
max_upload_size
id1224056
size21,401
Thomas Zahner (thomas-zahner)

documentation

README

long-running-task

A simple library to handle long-running tasks.

Why?

When exposing RESTful HTTP API paths to clients which trigger slow and/or computationally expensive operations it is best practice to make use of the long-running task concept.

When making use of this concept a single endpoint, which blocks until the operation is completed, is replaced with two endpoints. The first endpoint is used start the task. The second endpoint is used to get the state of the running task. It may be in progress (Pending) or may be completed (Done).

This crate helps to manage and keep track of long-running tasks.

Features

  • Manage and keep track of the progress of tasks and their results
  • Enable the serde feature to make tasks serialisable and use them in combination with a web-frameworks
  • Configure a lifespan to prevent completed tasks from living on indefinitely if they are not retrieved

Get started

Take a look at the Rocket example to learn how to design REST API endpoints for long-running tasks.

Commit count: 26

cargo fmt