Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Introduce 'interval' to control the scheduler interval #167

Closed
wants to merge 4 commits into from
Closed

Introduce 'interval' to control the scheduler interval #167

wants to merge 4 commits into from

Conversation

dwijnand
Copy link

@dwijnand dwijnand commented Oct 6, 2018

Fixes #165

Hey! So I'm extremely noob here, but this seems to be passing npm test for me locally.. Is it right? Help very welcome!


View rendered README.md

Copy link
Contributor

@hiimbex hiimbex left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @dwijnand! No worries about the newbness, we've all been there!

The biggest weirdness about this change is that it happens outside the scope of lib/stale.js which has a method for combining the config with the defaults nicely using the lib/schema.js

I'd also love to see some tests that demonstrate this functionality, but not sure the best way to go about it. @bkeepers might have an idea?

lib/schema.js Outdated

interval: Joi.number().integer().min(1).max(24)
.error(() => '"interval" must be an integer between 1 and 24')
.description('The number of hours to schedule a run, 1-24. Default is 1')
Copy link
Contributor

Choose a reason for hiding this comment

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

Right now this isn't actually used.

README.md Outdated
@@ -56,6 +56,9 @@ markComment: >
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30

# The number of hours to schedule a run, 1-24. Default is 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe # The number of hours per day to schedule a run, 1-24. Default is 1 is slightly more clear?

@dwijnand
Copy link
Author

dwijnand commented Oct 6, 2018

Thanks for the speedy review, @hiimbex! Hopefully we can figure out how to test this and verify it works, meanwhile I've pushed changes for the easy parts.

@hiimbex hiimbex requested a review from bkeepers October 10, 2018 04:26
@dwijnand
Copy link
Author

Any thoughts, @bkeepers? I'd love to be able to tweak this behaviour in stale bot!

@dwijnand
Copy link
Author

@hiimbex How do you feel about accepting this as is, and forward-fixing any issues if they crop up?

I'd be happy to submit a follow-up PR with a test for this, once we have some idea how to test it.

@hiimbex
Copy link
Contributor

hiimbex commented Oct 18, 2018

@dwijnand I still this needs updating since as I mentioned, the schema isn't actually used in the index.js, only from stale, so the changes to the schema and it's test should be removed since they're never used.

@dwijnand
Copy link
Author

Done! Despite it not being used, I thought it would be good to have for consistency. But I don't mind dropping it.

Copy link
Contributor

@bkeepers bkeepers left a comment

Choose a reason for hiding this comment

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

@dwijnand thanks for the pull request, but I don't think this will work like you expect. probot-scheduler will need to be rewritten to allow scheduling for a single repository in order to have the intended effect.

let interval = 1
if (config && config.interval) {
interval = config.interval
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There would need to be some validations for the values of config.interval here, otherwise I could set a value of 0.00001 and it would trigger this every 3 milliseconds, which would likely cause some problems.

// Visit all repositories to mark and sweep stale issues
let scheduler = createScheduler(app, {
interval: interval * 60 * 60 * 1000
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Schedulers currently scan all repositories for all installations. So this would create a duplicate scheduler for every single repository, but that scheduler is not isolated to the single repository.

@dwijnand
Copy link
Author

Damn... that makes this more complicated. 😞

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants