From: Michael Tremer Date: Tue, 30 Dec 2025 16:55:51 +0000 (+0000) Subject: lists: Account for how many open reports there X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27ad2dba23d72345c43bc259946ea4dfee609f4c;p=dbl.git lists: Account for how many open reports there Signed-off-by: Michael Tremer --- diff --git a/src/database.sql b/src/database.sql index 979d869..7db7a75 100644 --- a/src/database.sql +++ b/src/database.sql @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- -\restrict Hq2I33CNLRM7K7kcCycXF0u7UASfMPt7lX7HhX0lOG4SePHngyo8IfElIz9I44O +\restrict yRgVASc7gN0f8tKEAi5kP5eoBt9MCpuKcneTEiATwCoxABuwGL5zUJdhirU6taT -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1) -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1) @@ -84,7 +84,8 @@ CREATE TABLE public.lists ( license text NOT NULL, updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, description text, - total_domains integer DEFAULT 0 NOT NULL + total_domains integer DEFAULT 0 NOT NULL, + pending_reports integer DEFAULT 0 NOT NULL ); @@ -394,5 +395,5 @@ ALTER TABLE ONLY public.sources -- PostgreSQL database dump complete -- -\unrestrict Hq2I33CNLRM7K7kcCycXF0u7UASfMPt7lX7HhX0lOG4SePHngyo8IfElIz9I44O +\unrestrict yRgVASc7gN0f8tKEAi5kP5eoBt9MCpuKcneTEiATwCoxABuwGL5zUJdhirU6taT diff --git a/src/dnsbl/lists.py b/src/dnsbl/lists.py index 125ce02..99e7a8b 100644 --- a/src/dnsbl/lists.py +++ b/src/dnsbl/lists.py @@ -372,3 +372,7 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True): Creates a new report for this list """ return self.backend.reports.create(list=self, **kwargs) + + # Pending Reports + + pending_reports : int = 0 diff --git a/src/dnsbl/reports.py b/src/dnsbl/reports.py index 565ed19..c96e891 100644 --- a/src/dnsbl/reports.py +++ b/src/dnsbl/reports.py @@ -66,6 +66,9 @@ class Reports(object): Report, **kwargs, ) + # Increment the counter of the list + report.list.pending_reports += 1 + return report @@ -115,4 +118,7 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True): # Close! def close(self): - pass # XXX TODO + # Decrement the counter for pending reports + report.list.pending_reports -= 1 + + # XXX TODO