Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 9.6% on proxy.golang.org

proxy.golang.org : github.com/meshapi/go-shutdown

Package shutdown contains utilities to gracefully handle kernel interrupts and shutdown procedures. This package provides means to define a shutdown pipeline, which can contain sequential and parallel steps to complete a shutdown and also ways to trigger the pipeline either via signals or manually. To create a pipeline manager, use the following code: There is a default shutdown manager that can be accessed via Default() method and many package-level functions are available as a shortcut to accessing the default manager's methods. The default manager uses the standard log package for logging. The shutdown manager allows the addition of steps to the shutdown procedure, with some steps capable of running in parallel, while others run sequentially. The shutdown procedure can be triggered manually or by subscribing to kernel SIGTERM interrupt signals. There are three main methods for adding steps into the shutdown manager. The shutdown manager monitors the added steps and organizes them into sequential groups. Unless explicitly specified to form a distinct group, consecutive steps with the same parallel status are grouped together. * AddSteps: Adds steps that can run concurrently in separate goroutines. NOTE: Neighboring steps with the same parallelism status are grouped together. Thus the following lines have the same effect as the code above. * AddSequence: Adds steps that run one after another in the given order, without separate goroutines. * AddParallelSequence: Adds steps to be executed in parallel, with an explicit instruction for the manager to wait for all steps prior to finish before starting the execution of this group. Additional features include: * SetLogger: Set a custom logger for the shutdown pipeline (default is plog.Default()). * SetTimeout: Define a timeout for the execution of the entire shutdown pipeline. * SetCompletionFunc: Add a callback function to handle the end of the shutdown pipeline, ensuring it gets called in any case, even in the presence of panics, errors, or timeouts.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/meshapi/go-shutdown
Keywords: go, golang, graceful-shutdown, shutdown
License: MIT
Latest release: 5 months ago
First release: 5 months ago
Namespace: github.com/meshapi
Stars: 2 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 16 days ago

    Loading...
    Readme
    Loading...