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

Future: Deadlines and Cancelation patterns #24

Closed
@ktoso

Description

@ktoso

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions