forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
32 lines (26 loc) · 944 Bytes
/
utils.py
File metadata and controls
32 lines (26 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright The IETF Trust 2026, All Rights Reserved
import json
from functools import partial
from django.db import transaction
from ietf.blobdb.replication import replication_enabled
from ietf.blobdb.tasks import pybob_the_blob_replicator_task
def queue_for_replication(bucket: str, name: str, using: str | None=None):
"""Queue a blob for replication
This is private to the blobdb app. Do not call it directly from other apps.
"""
if not replication_enabled(bucket):
return
# For now, fire a celery task we've arranged to guarantee in-order processing.
# Later becomes pushing an event onto a queue to a dedicated worker.
transaction.on_commit(
partial(
pybob_the_blob_replicator_task.delay,
json.dumps(
{
"name": name,
"bucket": bucket,
}
)
),
using=using,
)