Skip to content

Gracefully ending a component-in-progress, e.g. batching metrics #611

@alexcrichton

Description

@alexcrichton

Currently the component model does not have any mechanisms by which the background work of a task, post return, can be gracefully cancelled or ended. A use case for this would be to have a wasi:http/service component which batches a number of requests together in terms of metrics and sends them off at the end. In this situation there's a tension when a host decides to stop sending requests to an instance and when the automatic batch-sending-logic will trigger. Ideally there would be some sort of signal that a host could send to a component and say "hey please shut down everything now" which post-return tasks would receive and could, for example, trigger a batched send. The host could then presumably place a hard deadline after this signal were sent to when the entire component is dropped anyway, but it'd have an opportunity to gracefully shut down in a sense.

This is spun out of #608 as the conclusion there is we probably won't be changing anything for the time being. This issue has historically been solved with a "stop" function of some form (or notification/etc) but hasn't been fully fleshed out yet (unless @lukewagner has a secret slide deck).

In any case I wanted to open an issue for this use case to have discussion about this possible direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions