{"action":"created","issue":{"url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/127","repository_url":"https://api.github.com/repos/seejohnrun/ice_cube","labels_url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/127/comments","events_url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/127/events","html_url":"https://github.com/seejohnrun/ice_cube/issues/127","id":8883562,"number":127,"title":"Conflicting Recurrence Rules and Exception Rules run indefinitely","user":{"login":"magiluke","id":1635158,"avatar_url":"https://avatars.githubusercontent.com/u/1635158?v=3","gravatar_id":"","url":"https://api.github.com/users/magiluke","html_url":"https://github.com/magiluke","followers_url":"https://api.github.com/users/magiluke/followers","following_url":"https://api.github.com/users/magiluke/following{/other_user}","gists_url":"https://api.github.com/users/magiluke/gists{/gist_id}","starred_url":"https://api.github.com/users/magiluke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magiluke/subscriptions","organizations_url":"https://api.github.com/users/magiluke/orgs","repos_url":"https://api.github.com/users/magiluke/repos","events_url":"https://api.github.com/users/magiluke/events{/privacy}","received_events_url":"https://api.github.com/users/magiluke/received_events","type":"User","site_admin":false},"labels":[{"id":41865,"url":"https://api.github.com/repos/seejohnrun/ice_cube/labels/bug","name":"bug","color":"e10c02","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2012-12-01T03:26:32Z","updated_at":"2017-01-18T16:21:21Z","closed_at":null,"body":"If I have conflicting rules and call next_occurrences, it will loop indefinitely, regardless of end_time.\n\nFor instance:\n\n``` ruby\nschedule = Schedule.new(\"2012-12-1\".to_time, :end_time => \"2012-12-10\".to_time)\nschedule.add_recurrence_rule Rule.daily\nschedule.add_exception_rule Rule.daily\nschedule.next_occurrences(20)\n```\n\nThis will just loop on forever. In the next_time function, it will always find a new value:\n\n``` ruby\nif res = rule.next_time(time, self, closing_time)\n  if min_time.nil? || res < min_time\n    min_time = res\n  end\nend\n```\n\nAnd then break out of the loop because it finds an occurrence:\n\n``` ruby\nif exception_time?(min_time)\n  time = min_time + 1\n  min_time = nil\n  next\nend\n```\n\nIt should consider the end date for when it hits a scenario like this, and perhaps have a max loop iteration limit when it finds no match, or at least an arbitrarily far off end date if one isn't supplied.\n"},"comment":{"url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/comments/273522548","html_url":"https://github.com/seejohnrun/ice_cube/issues/127#issuecomment-273522548","issue_url":"https://api.github.com/repos/seejohnrun/ice_cube/issues/127","id":273522548,"user":{"login":"avit","id":4278,"avatar_url":"https://avatars.githubusercontent.com/u/4278?v=3","gravatar_id":"","url":"https://api.github.com/users/avit","html_url":"https://github.com/avit","followers_url":"https://api.github.com/users/avit/followers","following_url":"https://api.github.com/users/avit/following{/other_user}","gists_url":"https://api.github.com/users/avit/gists{/gist_id}","starred_url":"https://api.github.com/users/avit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avit/subscriptions","organizations_url":"https://api.github.com/users/avit/orgs","repos_url":"https://api.github.com/users/avit/repos","events_url":"https://api.github.com/users/avit/events{/privacy}","received_events_url":"https://api.github.com/users/avit/received_events","type":"User","site_admin":false},"created_at":"2017-01-18T16:21:21Z","updated_at":"2017-01-18T16:21:21Z","body":"Related: https://github.com/avit/schedule_attributes/issues/21"}}
{"actor":{"display_login":"avit"}}