{"id":18438263,"url":"https://github.com/pumpkinseed/shutdown","last_synced_at":"2025-10-27T02:05:29.223Z","repository":{"id":57493208,"uuid":"198401168","full_name":"PumpkinSeed/shutdown","owner":"PumpkinSeed","description":"Graceful shutdown package for Go","archived":false,"fork":false,"pushed_at":"2019-09-05T09:37:06.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-03T02:03:24.668Z","etag":null,"topics":["graceful-shutdown","microservice","reliability","shutdown","shutdown-manager"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PumpkinSeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-23T09:46:36.000Z","updated_at":"2019-09-05T09:36:10.000Z","dependencies_parsed_at":"2022-08-28T17:02:36.990Z","dependency_job_id":null,"html_url":"https://github.com/PumpkinSeed/shutdown","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/PumpkinSeed/shutdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Fshutdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Fshutdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Fshutdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Fshutdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PumpkinSeed","download_url":"https://codeload.github.com/PumpkinSeed/shutdown/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PumpkinSeed%2Fshutdown/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245315,"owners_count":23436513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graceful-shutdown","microservice","reliability","shutdown","shutdown-manager"],"created_at":"2024-11-06T06:19:17.959Z","updated_at":"2025-10-27T02:05:29.153Z","avatar_url":"https://github.com/PumpkinSeed.png","language":"Go","readme":"# shutdown\n\nGraceful shutdown package for Go services with built-in healthcheck for persistent dependencies.\n\n# Usage\n\n### Shutdown\n\nEverything what depends on the graceful shutdown (ex.: long-time file writes, database connection, http requests), most implement the `ServiceDescriptor` interface.\n\n```go\npackage example\ntype ServiceDescriptor interface {\n\tStop() error\n\tPing() error\n\tReconnect() error\n}\n```\n\nAlso the constructor requires a logging instance with the following interface implementation.\n\n```go\npackage example\ntype Log interface {\n\tErrorf(format string, args ...interface{})\n\tInfof(format string, args ...interface{})\n\tDebugf(format string, args ...interface{})\n\tWarnf(format string, args ...interface{})\n}\n```\n\nCreate a new instance of the shutdown and adding new services and call the `GracefulExit` handler.\n\n```go\npackage example\n\nhandler := shutdown.NewHandler(\u0026testLog{t})\nhandler.Add(\"service1\", \"\", shutdown.Init, \u0026service1)\nwg := \u0026sync.WaitGroup{}\nshutdown.GracefuleExit(handler, wg)\n\nwg.Wait()\n```\n\nDetermine the sequence of the shutdown when we add them into the list.\n\n```go\npackage example\n\nhandler := shutdown.NewHandler(\u0026testLog{t})\nhandler.Add(\"service1\", \"\", shutdown.Init, \u0026service1)\nhandler.Add(\"service2\", \"service1\", shutdown.Before, \u0026service2)\nhandler.Add(\"service3\", \"service2\", shutdown.After, \u0026service3)\nwg := \u0026sync.WaitGroup{}\nshutdown.GracefuleExit(handler, wg)\n```\n\n### Important\nHealthcheck not fully implemented yet!\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpumpkinseed%2Fshutdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpumpkinseed%2Fshutdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpumpkinseed%2Fshutdown/lists"}