Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Future: Deadlines and Cancelation patterns #24

Closed
ktoso opened this issue Aug 24, 2020 · 0 comments
Closed

Future: Deadlines and Cancelation patterns #24

ktoso opened this issue Aug 24, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@ktoso
Copy link
Collaborator

ktoso commented Aug 24, 2020

We'll eventually want to also define patterns for distributed deadlines with context.

We'd like to be able to use context to protect tail latencies of services, e.g. if a service call is already past its deadline, there's no reason to continue working on the downstream calls it caused.

Downstreams would need to protect their expensive calls using something like:

func expensiveOperation(context: BaggageContext) throws { 
  guard context.deadline else { // specific spelling not sure about yet, also because swift concurrency 
    throw DeadlineExceeded(context)
  }
}

We would like to ensure cancelation works well with whatever the swift concurrency story becomes and how it'd handle cancelation as well.


Composing and "sub deadlines" must be easy to compose, it should be easily possible to "my entire work should take 1 minute (until time T)" but each sub task must take no longer than a few seconds (until t1)" so we must allow composing deadlines like such.

The deadline should always take the "lower of the current deadline, and the passed in one".


If we'd ever get function wrappers, it could become @DeadlineRespecting (terrible name, we'd find a good one) that does this automatically.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants