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

Add next/previous firing time to context message #80

Merged
merged 2 commits into from
Sep 5, 2020

Conversation

kvma
Copy link
Contributor

@kvma kvma commented Dec 14, 2018

Changes include:

  • Adding the next/previous firing time to the context message allowing users to retrieve next/previous firing time.
  • Test
  • Fixed some formatting inconsistencies
  • Doc cleanup
  • Made tests less sensitive. I picked 500 ms since it's double the frequency of the max frequency of cron (per second)

@kvma
Copy link
Contributor Author

kvma commented Feb 14, 2019

Hey @enragedginger - any way we can see this functionality make it back into the project? This is my first contribution so let me know what's the best way to to move forward.

@enragedginger
Copy link
Owner

Hi @kvma,

I tried reviewing this diff today. It looks like there's several old commits and file changes showing up as part of this PR which are already on master. Can you correct this so that the Files Changed tab of this PR only shows your changes?

@kvma
Copy link
Contributor Author

kvma commented Sep 17, 2019

@enragedginger - thanks for taking a look - I've backed the rebase I did and should be a cleaner PR now.

@lastseenjustnow
Copy link

lastseenjustnow commented May 16, 2020

@enragedginger @kvma Shall this PR be merged? Had to create QuartzSchedulerExtention2 to implement nextFireTime checks.
https://github.com/lastseenjustnow/blp-scala/blob/master/rate/src/main/scala/rates/QuartzSchedulerExtension2.scala

Copy link
Owner

@enragedginger enragedginger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks pretty good to me. I think we can simplify it a bit. Let me know what you think.

Thanks for your contribution on this and sorry it took me so long to look at it (both times)!

/* This is a somewhat questionable test as the timing between components may not match the tick off. */
val receipt = probe.receiveWhile(Duration(1, MINUTES), Duration(15, SECONDS), 5) {
case TockWithFireTime(scheduledFireTime) =>
scheduledFireTime
}
0 until 5 foreach { i =>
assert(receipt(i)==jobDt.getTime+i*10*1000)
assert(receipt(i) === jobDt.getTime + i * 10 * 1000 +- tickTolerance)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for adding tickTolerance here? Was this test flaky?

Copy link
Contributor Author

@kvma kvma May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, the test was flakey. This was just a pattern that I had used in the past that helped isolate functional issues with performance issues.

@@ -4,6 +4,19 @@ import java.util.Date
/**
* wrap msg with scheduledFireTime
*/
final case class MessageWithFireTime(msg: AnyRef, scheduledFireTime:Date)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of breaking this out into several traits / classes, what are your thoughts on just changing the definition to this:
final case class MessageWithFireTimes(msg: AnyRef, scheduledFireTime: Date, previousFiringTime: Option[Date] = None, nextFiringTime: Option[Date] = None) and then always setting all three of those fields?

This should give us all of the same benefits of your initial commits while preserving backwards compatibility too.

EDIT:
Just to clarify, then we can get rid of the extra traits / classes added below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely - the thinking here was being conservative to maintain API compatibility to the preserve the original class MessageWithFireTime. I'm happy to flatten it, but i felt it was more intrusive as my first contribution :)

@enragedginger enragedginger merged commit 849f3c4 into enragedginger:master Sep 5, 2020
@enragedginger
Copy link
Owner

I've merge this. However, I'm going to refactor it with the Option field definitions as mentioned above before pushing the new build.

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

Successfully merging this pull request may close these issues.

3 participants