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

[FIX] runbot: avoid traceback when forcing a preparing batch #734

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions runbot/controllers/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ def bundle(self, bundle=None, page=1, limit=50, **kwargs):
def force_bundle(self, bundle, auto_rebase=False, **_post):
_logger.info('user %s forcing bundle %s', request.env.user.name, bundle.name) # user must be able to read bundle
batch = bundle.sudo()._force()
batch._log('Batch forced by %s', request.env.user.name)
batch._prepare(auto_rebase)
return werkzeug.utils.redirect('/runbot/batch/%s' % batch.id)
if batch:
batch._log('Batch forced by %s', request.env.user.name)
batch._prepare(auto_rebase)
return werkzeug.utils.redirect('/runbot/batch/%s' % batch.id)
Comment on lines +213 to +216
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that we should actually return self.last_batch in the _forcemethod.
in this case this will redirect to the existing batch, but also prepare it immediately without waiting the full time.

In this case, we will also need to check for the state in _prepare

if not self.state == "preparing":
    return

Or if you prefer to avoid to change this behaviour, we can also return the redirect in all case but fallbacking on last_batch if batch is None


@route(['/runbot/batch/<int:batch_id>'], website=True, auth='public', type='http', sitemap=False)
def batch(self, batch_id=None, **kwargs):
Expand Down