{"action":"created","issue":{"url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/36","labels_url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/36/comments","events_url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/36/events","html_url":"https://github.com/yigit/android-priority-jobqueue/issues/36","id":98063453,"number":36,"title":"queue job replacement strategies","user":{"login":"kherink","id":1751004,"avatar_url":"https://avatars.githubusercontent.com/u/1751004?v=3","gravatar_id":"","url":"https://api.github.com/users/kherink","html_url":"https://github.com/kherink","followers_url":"https://api.github.com/users/kherink/followers","following_url":"https://api.github.com/users/kherink/following{/other_user}","gists_url":"https://api.github.com/users/kherink/gists{/gist_id}","starred_url":"https://api.github.com/users/kherink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kherink/subscriptions","organizations_url":"https://api.github.com/users/kherink/orgs","repos_url":"https://api.github.com/users/kherink/repos","events_url":"https://api.github.com/users/kherink/events{/privacy}","received_events_url":"https://api.github.com/users/kherink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-30T01:25:18Z","updated_at":"2015-08-09T15:24:57Z","closed_at":null,"body":"Hi,\r\nat one a point in the past I've implemented my own job queue (which i have since discarded in favor of this project). What i do miss though is a piece functionality that would allow a new job, that is about to be added to the queue, to determine if infact it should: \r\n- be added (default behaviour)\r\n- be added and supersede an existing job (eg: updating the same resource 2x where only the last change needs to be propagated)\r\n- not be added (current job is duplicating work that is already pending)\r\n- not be added as well as cancel an existing job (eg: job is pending to create a resource that this job is deleting)\r\nbased on the state of the queue at the time.\r\n\r\nThis is important in situations where for example an application is running off-line for an extended period of time and jobs begin to pile up and we have user actions that cancel each other (eg: locally rename a resource 2x - it makes sense to only send the second final change to the server)\r\n\r\nA possible way to implement this is to allow each job, at the point of being added, to examine every other job of interest on the queue and provide info on what the queue should do next (eg.:  KEEP_BOTH, KEEP_SELF, KEEP_OTHER, KEEP_NONE) where KEEP_BOTH is the default (current) behaviour.\r\n\r\nIs there anything like this on the road-map?\r\n\r\nCheers,\r\nKarel\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/comments/129198731","html_url":"https://github.com/yigit/android-priority-jobqueue/issues/36#issuecomment-129198731","issue_url":"https://api.github.com/repos/yigit/android-priority-jobqueue/issues/36","id":129198731,"user":{"login":"yigit","id":89202,"avatar_url":"https://avatars.githubusercontent.com/u/89202?v=3","gravatar_id":"","url":"https://api.github.com/users/yigit","html_url":"https://github.com/yigit","followers_url":"https://api.github.com/users/yigit/followers","following_url":"https://api.github.com/users/yigit/following{/other_user}","gists_url":"https://api.github.com/users/yigit/gists{/gist_id}","starred_url":"https://api.github.com/users/yigit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yigit/subscriptions","organizations_url":"https://api.github.com/users/yigit/orgs","repos_url":"https://api.github.com/users/yigit/repos","events_url":"https://api.github.com/users/yigit/events{/privacy}","received_events_url":"https://api.github.com/users/yigit/received_events","type":"User","site_admin":false},"created_at":"2015-08-09T15:24:57Z","updated_at":"2015-08-09T15:24:57Z","body":"You can provide your own QueueFactory where you can customize the behavior of your queue. \r\nIf it can pass the Queue tests, it should be mostly OK but since we don't have any additional queues, it is hard to be confident about it. You can further change the source code to use your queues by default and run all tests. You should have pretty good coverage in that case.\r\n\r\nSupporting different queues was initially scoped, which is why the QueueFactory exists but there has not been much interest in it. I'm open to changes in the Queue / Job Manager API to support your use cases with existing queues or alternatives queues. "}}