-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathchannels.py
More file actions
55 lines (39 loc) · 1.46 KB
/
channels.py
File metadata and controls
55 lines (39 loc) · 1.46 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from dataclasses import dataclass
from pgpubsub.channel import TriggerChannel
from shared.models import NixDerivation
from shared.models.cve import Container
from shared.models.issue import NixpkgsIssue
from shared.models.linkage import CVEDerivationClusterProposal
from shared.models.nix_evaluation import NixChannel, NixEvaluation
@dataclass
class NixChannelUpdateChannel(TriggerChannel):
model = NixChannel
lock_notifications = True
@dataclass
class NixChannelInsertChannel(TriggerChannel):
model = NixChannel
lock_notifications = True
@dataclass
class NixEvaluationChannel(TriggerChannel):
model = NixEvaluation
# To avoid having a process blocked on the same evaluation multiple times.
# We want to ensure that notifications are processed exactly once.
# For this, we need to take a lock in the PostgreSQL database via `SELECT FOR UPDATE`
# and let the pub-sub algorithm loop over available notifications with skip_locked.
lock_notifications = True
@dataclass
class NixDerivationChannel(TriggerChannel):
model = NixDerivation
@dataclass
class ContainerChannel(TriggerChannel):
model = Container
# Process new structured data for a CVE only once.
lock_notifications = True
@dataclass
class CVEDerivationClusterProposalChannel(TriggerChannel):
model = CVEDerivationClusterProposal
lock_notifications = True
@dataclass
class NixpkgsIssueChannel(TriggerChannel):
model = NixpkgsIssue
lock_notifications = False