Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop with all_occurrences #18

Open
dgilperez opened this issue Jan 29, 2014 · 1 comment
Open

Infinite loop with all_occurrences #18

dgilperez opened this issue Jan 29, 2014 · 1 comment

Comments

@dgilperez
Copy link

I've been fighting with this for a while, with no success.

Please check this test:

dgilperez@544b2fe

If you run it as it is, it passes.
If you comment out the puts line, it will output the attributes, but then all_occurrences hangs (infinite loop??).

This is blocking us a production upgrade.

Any idea, please?

@dgilperez
Copy link
Author

I'm narrowing down this thing.

So I have my model with scheduled_attributes, with the following schedule shown in the console.

> model.schedule =>
#<IceCube::Schedule:0x0000010ca8fbf8 @start_time=Thu, 28 Mar 2013 00:00:00 CET +01:00, @all_recurrence_rules=[#<IceCube::DailyRule:0x0000010ca8f928 @validations={:interval=>[#<IceCube::Validations::DailyInterval::Validation:0x0000010ca8f8b0 @interval=1>], :base_hour=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f6f8 @type=:hour>], :base_min=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f658 @type=:min>], :base_sec=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f5b8 @type=:sec>], :until=>[#<IceCube::Validations::Until::Validation:0x0000010ca8f4c8 @time=Thu, 27 Mar 2014 00:00:00 CET +01:00>]}, @interval=1, @uses=365, @until=Thu, 27 Mar 2014 00:00:00 CET +01:00, @time=Thu, 27 Mar 2014 00:00:01 CET +01:00, @schedule=#<IceCube::Schedule:0x0000010ca8fbf8 ...>>], @all_exception_rules=[]>

When I call model.schedule_attributes on the same console, and then back to model.schedule, surprisingly, the results are different !

#<IceCube::Schedule:0x0000010ca8fbf8 @start_time=Thu, 28 Mar 2013 00:00:00 CET +01:00, @all_recurrence_rules=[#<IceCube::DailyRule:0x0000010ca8f928 @validations={:interval=>[#<IceCube::Validations::DailyInterval::Validation:0x0000010ca8f8b0 @interval=1>], :base_hour=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f6f8 @type=:hour>], :base_min=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f658 @type=:min>], :base_sec=>[#<IceCube::Validations::ScheduleLock::Validation:0x0000010ca8f5b8 @type=:sec>], :until=>[#<IceCube::Validations::Until::Validation:0x0000010ca8f4c8 @time=Thu, 27 Mar 2014 00:00:00 CET +01:00>], :month_of_year=>[]}, @interval=1, @uses=365, @until=Thu, 27 Mar 2014 00:00:00 CET +01:00, @time=Thu, 27 Mar 2014 00:00:01 CET +01:00, @schedule=#<IceCube::Schedule:0x0000010ca8fbf8 ...>>], @all_exception_rules=[]>

Please note the new :month_of_year=>[] inside :until. That thing is crashing IceCube, since it will not get out the find_acceptable_time_before(boundary) loop in validated_rule.rb. That is of course an IceCube bug, but I believe schedule_attributes should not change the Schedule object just by calling a getter method such as #schedule_attributes, don't you agree?

Any idea about why is this happening and how to solve it or work-around it?

Thanks!

dgilperez added a commit to dgilperez/schedule_attributes that referenced this issue Jan 30, 2014
…f no validation applies, will alter Schedule::Rule, initializing @validations[:month_of_year] with an empty array. Both IceCube and schedule_attributes will benefit for some refactoring of these areas, but this fixes this for now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant