4f95c9de4e
* v3: cancel subtasks when parent task runs are cancelled * v3: recover from server rate limiting errors in a more reliable way - Changing from sliding window to token bucket in the API rate limiter, to help smooth out traffic - Adding spans to the API Client core & SDK functions - Added waiting spans when retrying in the API Client - Retrying in the API Client now respects the x-ratelimit-reset - Retrying ApiError’s in tasks now respects the x-ratelimit-reset - Added AbortTaskRunError that when thrown will stop retries - Added idempotency keys SDK functions and automatically injecting the run ID when inside a task - Added the ability to configure ApiRequestOptions (retries only for now) globally and on specific calls - Implement the maxAttempts TaskRunOption (it wasn’t doing anything before) * Adding some docs about the request options * Fix type error * Remove context propagation through graphile jobs * Remove logger * only select a subset of task run columns * limit columns selected in batchTrigger as well * added idempotency doc * allow scoped idempotency keys, and fixed an issue with the unique index on BatchTaskRun and TaskRun * Removed old cancel task run children code
20 lines
541 B
TypeScript
20 lines
541 B
TypeScript
import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
|
export type HttpLocalStorage = {
|
|
requestId: string;
|
|
path: string;
|
|
host: string;
|
|
};
|
|
|
|
const httpLocalStorage = new AsyncLocalStorage<HttpLocalStorage>();
|
|
|
|
export type RunWithHttpContextFunction = <T>(context: HttpLocalStorage, fn: () => T) => T;
|
|
|
|
export function runWithHttpContext<T>(context: HttpLocalStorage, fn: () => T): T {
|
|
return httpLocalStorage.run(context, fn);
|
|
}
|
|
|
|
export function getHttpContext(): HttpLocalStorage | undefined {
|
|
return httpLocalStorage.getStore();
|
|
}
|