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

Sleep even less between polling for MRs #75

Merged
merged 1 commit into from
Jan 26, 2018
Merged

Conversation

aschmolck
Copy link
Contributor

The logic is: we want to sleep at least 30 secs after iterating over all
projects (both so that people have a chance to undo accidental assignments to
marge and to not poll like crazy when nothing is happening to the repo). If
there are many projects, the current system sleeps too long, though. Let's just
sleep one sec between each by default and then make up the difference to the 30s
afterwards.

marge/bot.py Outdated
time.sleep(time_to_sleep_between_projects_in_secs)
time.sleep(max(0,
min_time_to_sleep_after_iterating_all_projects -
time_to_sleep_between_projects_in_secs * len(filtered_projects)))
Copy link
Contributor

Choose a reason for hiding this comment

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

@aschmolck As it is, we are going to let the user know that marge is about to sleep for 1 sec, and fail to log anything when sleeping for 30 secs. This should be the other way round.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The logic is: we want to sleep at least 30 secs after iterating over all
projects (both so that people have a chance to undo accidental assignments to
marge and to not poll like crazy when nothing is happening to the repo). If
there are many projects, the current system sleeps too long, though. Let's just
sleep one sec between each by default and then make up the difference to the 30s
afterwards.
@mrusu91
Copy link
Contributor

mrusu91 commented Jan 23, 2018

@aschmolck I think travis works now without deprecated set

@mrusu91 mrusu91 closed this Jan 26, 2018
@mrusu91 mrusu91 reopened this Jan 26, 2018
@mrusu91 mrusu91 merged commit 420aa41 into master Jan 26, 2018
@glensc
Copy link
Contributor

glensc commented Feb 4, 2018

i was thinking too when first installed marge-bot. i.e does make difference how marge is project member...

what do you suggest? assign bot to group or every project manually. is there any difference?

@jcpetruzza
Copy link
Contributor

With this change, it shouldn't make a huge difference difference how many projects can be accessed. Assigning marge to projects / groups should be a matter of admin preference, I think

@glensc
Copy link
Contributor

glensc commented Feb 12, 2018

btw, if i look at marge's log, it makes api calls to each project. perhaps gitlab can have api call to give "all mr's i'm assigned to", any attempt to make feature request to gitlab-org?

@jcpetruzza
Copy link
Contributor

There seems to be indeed such an endpoint since 9.5: https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests

Since we want to ensure that no project starves another one, to use this endpoint we'd have to fetch all pages for this request, pick the oldest per project and iterate over those. Still, between merge requests, we need to check that next merge request we are to process is still assigned to us, etc. I'm not sure it will make a significant difference, but if anyone wants to give it a go, I'd be happy to review a PR.

JaimeLennox referenced this pull request Nov 30, 2018
In order to enable bot derived class to launch different kind of jobs.
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.

4 participants