{"action":"closed","issue":{"url":"https://api.github.com/repos/mperham/sidekiq/issues/3027","repository_url":"https://api.github.com/repos/mperham/sidekiq","labels_url":"https://api.github.com/repos/mperham/sidekiq/issues/3027/labels{/name}","comments_url":"https://api.github.com/repos/mperham/sidekiq/issues/3027/comments","events_url":"https://api.github.com/repos/mperham/sidekiq/issues/3027/events","html_url":"https://github.com/mperham/sidekiq/issues/3027","id":161526403,"number":3027,"title":"Consider keeping a succeeded batch in a list for 24hrs","user":{"login":"krasnoukhov","id":944286,"avatar_url":"https://avatars.githubusercontent.com/u/944286?v=3","gravatar_id":"","url":"https://api.github.com/users/krasnoukhov","html_url":"https://github.com/krasnoukhov","followers_url":"https://api.github.com/users/krasnoukhov/followers","following_url":"https://api.github.com/users/krasnoukhov/following{/other_user}","gists_url":"https://api.github.com/users/krasnoukhov/gists{/gist_id}","starred_url":"https://api.github.com/users/krasnoukhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krasnoukhov/subscriptions","organizations_url":"https://api.github.com/users/krasnoukhov/orgs","repos_url":"https://api.github.com/users/krasnoukhov/repos","events_url":"https://api.github.com/users/krasnoukhov/events{/privacy}","received_events_url":"https://api.github.com/users/krasnoukhov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-21T20:02:49Z","updated_at":"2016-06-22T15:47:50Z","closed_at":"2016-06-22T15:47:50Z","body":"I was just thinking that it could be very useful to see a list or recent batches in a Web UI, just for a quick glance. So since batch hash is being kept anyway now for internal reasons (#3011), it might make sense to keep the bid in a list as well.\r\n\r\nI tried implementing that myself, like pushing it back on success, but since callbacks are ran _before_ batch is removed from a list, it does not seem like solution is obvious on app side.\r\n\r\nSo my suggestion would be just to replace `zrem('batches'.freeze, bid)` call with `zremrangebyscore('batches'.freeze, '-inf'.freeze, Time.now.to_f - 86400)` in a `Sidekiq::Batch::Callback`, which should not add a lot of overhead or introduce a Redis memory leak. This way batch will still be removed from a list if `delete` is called directly on a batch object.\r\n\r\nPlease let me know if you want me to send a PR, I'd love to. Thanks!"}}
{"actor":{"display_login":"mperham"}}