mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00

Git gc can last a few minutes, it's not a big deal since it's executed once a day but the transaction is kept idele during this time wich is not useful. This commit should help to avoid this.
31 lines
974 B
Python
Executable File
31 lines
974 B
Python
Executable File
#!/usr/bin/python3
|
|
from tools import RunbotClient, run
|
|
import logging
|
|
import time
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
class LeaderClient(RunbotClient): # Conductor, Director, Main, Maestro, Lead
|
|
def __init__(self, env):
|
|
self.pull_info_failures = {}
|
|
super().__init__(env)
|
|
|
|
def on_start(self):
|
|
if self.env['ir.config_parameter'].sudo().get_param('runbot.runbot_do_fetch'):
|
|
_logger.info('Updating all repos')
|
|
for repo in self.env['runbot.repo'].search([('mode', '!=', 'disabled')]):
|
|
repo._update(force=True)
|
|
_logger.info('update finished')
|
|
|
|
def loop_turn(self):
|
|
if self.count == 0:
|
|
self.env['runbot.repo']._update_git_config()
|
|
self.env.cr.commit()
|
|
self.git_gc()
|
|
self.env.cr.commit()
|
|
return self.env['runbot.runbot']._fetch_loop_turn(self.host, self.pull_info_failures)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
run(LeaderClient)
|