MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / refresh_plugin_repos

Function refresh_plugin_repos

apps/plugins/tasks.py:10–33  ·  view source on GitHub ↗

Refresh cached manifests for all enabled plugin repos.

()

Source from the content-addressed store, hash-verified

8
9@shared_task
10def refresh_plugin_repos():
11 """Refresh cached manifests for all enabled plugin repos."""
12 from .models import PluginRepo
13 from .api_views import _fetch_manifest, _save_fetched_manifest_to_repo, _unmanage_dropped_slugs
14 from django.utils import timezone
15
16 repos = PluginRepo.objects.filter(enabled=True)
17 for repo in repos:
18 try:
19 key_text = repo.public_key if not repo.is_official else None
20 data, verified = _fetch_manifest(repo.url, public_key_text=key_text)
21 err = _save_fetched_manifest_to_repo(repo, data, verified)
22 if err:
23 logger.warning("Skipping repo '%s': %s", repo.name, err)
24 continue
25 _unmanage_dropped_slugs(repo, data)
26 logger.info("Refreshed plugin repo '%s'", repo.name)
27 except Exception as e:
28 resp = getattr(e, 'response', None)
29 status_str = str(resp.status_code) if resp is not None and hasattr(resp, 'status_code') else type(e).__name__
30 repo.last_fetch_status = status_str[:255]
31 repo.last_fetched = timezone.now()
32 repo.save(update_fields=["last_fetch_status", "last_fetched", "updated_at"])
33 logger.warning("Failed to refresh plugin repo '%s': %s", repo.name, e)

Callers

nothing calls this directly

Calls 5

_fetch_manifestFunction · 0.85
_unmanage_dropped_slugsFunction · 0.85
filterMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected