{"id":13651044,"url":"https://github.com/darron/sifter","last_synced_at":"2026-01-12T01:59:34.337Z","repository":{"id":57484828,"uuid":"45953254","full_name":"darron/sifter","owner":"darron","description":"Helps to prevent Consul from firing prematurely.","archived":false,"fork":false,"pushed_at":"2016-05-04T18:36:38.000Z","size":46,"stargazers_count":71,"open_issues_count":6,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-31T06:44:30.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/darron.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":"2015-11-11T01:53:31.000Z","updated_at":"2025-10-24T10:16:03.000Z","dependencies_parsed_at":"2022-08-26T11:10:50.770Z","dependency_job_id":null,"html_url":"https://github.com/darron/sifter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/darron/sifter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darron%2Fsifter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darron%2Fsifter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darron%2Fsifter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darron%2Fsifter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darron","download_url":"https://codeload.github.com/darron/sifter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darron%2Fsifter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28331490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-08-02T02:00:44.319Z","updated_at":"2026-01-12T01:59:34.322Z","avatar_url":"https://github.com/darron.png","language":"Go","readme":"sifter\n============\n\n[Consul watches](https://www.consul.io/docs/agent/watches.html) act in a bit of a interesting way - when you reload the program - they all fire.\n\nIt's a [fairly well known limitation that doesn't have a fix at the moment](https://github.com/hashicorp/consul/issues/571).\n\nIf it's a really lightweight process then it's not a big deal - but if it's not so lightweight - then it can be a bit of a problem.\n\nIf you take a look at what the watch passes on STDIN during a Consul reload - you will see that if it's not actually firing it just passes:\n\n`[]\\n`\n\nSo - `sifter` is a small Go binary that helps protect against event watches firing repeatedly:\n\n```\n{\n  \"watches\": [\n    {\n      \"type\": \"event\",\n      \"name\": \"chef-client\",\n      \"handler\": \"sifter run -e 'chef-client'\"\n    }\n  ]\n}\n```\n\nWhen this gets loaded into Consul - instead of launching copies and copies of `chef-client` processes - which is not awesome I promise - it will just say:\n\n`location='blank' elapsed='226.912µs' exec='chef-client'`\n\nWhen you actually send the event - the logs will show this - and the event will fire:\n\n```\ndecoded event='chef-client' ltime='1137'\nkey='sifter/chef-client/i-c972d41e' value='1137'\nlocation='complete' elapsed='47.448987142s' exec='chef-client'\n```\n\nAfterwards - if it sees the same event:\n\n`location='duplicate' elapsed='8.269276ms' exec='chef-client'`\n\n## Real World Usage\n\nDuring a cluster wide rollout of Consul changes - here are a number of events that were prevented from firing because they were duplicate or blank:\n\n![](http://shared.froese.org/2015/cexe8-15-41.jpg)\n\nI only want Consul watches to fire when they're supposed to.\n\n## Development\n\n`brew install forego` if you want to start up Redis and Consul to test.\n\nHave added some watches in the `config/` folder as well as example Consul output - input to sifter in the `test/` folder.\n","funding_links":[],"categories":["Projects"],"sub_categories":["Command Execution"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarron%2Fsifter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarron%2Fsifter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarron%2Fsifter/lists"}