Add dedicated celery task for codeberg
This commit is contained in:
@@ -533,8 +533,6 @@ def check_update_config_impl(package):
|
||||
config.last_tag = tag
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@celery.task(bind=True, rate_limit="7/m")
|
||||
def check_update_config(self, package_id):
|
||||
package: Package = Package.query.get(package_id)
|
||||
if package is None:
|
||||
@@ -567,6 +565,17 @@ def check_update_config(self, package_id):
|
||||
return
|
||||
|
||||
|
||||
@celery.task(bind=True, rate_limit="60/m")
|
||||
def check_update_config_default(self, package_id):
|
||||
check_update_config(self, package_id)
|
||||
|
||||
|
||||
@celery.task(bind=True, rate_limit="400/h")
|
||||
def check_update_config_codeberg(self, package_id):
|
||||
check_update_config(self, package_id)
|
||||
|
||||
|
||||
|
||||
@celery.task
|
||||
def check_for_updates():
|
||||
for update_config in PackageUpdateConfig.query.all():
|
||||
@@ -579,6 +588,9 @@ def check_for_updates():
|
||||
db.session.delete(update_config)
|
||||
continue
|
||||
|
||||
check_update_config.delay(update_config.package_id)
|
||||
if "codeberg.org" in update_config.package.repo:
|
||||
check_update_config_codeberg.delay(update_config.package_id)
|
||||
else:
|
||||
check_update_config_default.delay(update_config.package_id)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user