diff sat_pubsub/pgsql_storage.py @ 486:39a6c0bc914b

psql: handle case when `max_items == max` on node creation
author Goffi <goffi@goffi.org>
date Sun, 02 Oct 2022 15:38:42 +0200
parents 97010eefdfd9
children
line wrap: on
line diff
--- a/sat_pubsub/pgsql_storage.py	Sun Oct 02 15:33:36 2022 +0200
+++ b/sat_pubsub/pgsql_storage.py	Sun Oct 02 15:38:42 2022 +0200
@@ -281,6 +281,8 @@
             raise error.NoCollections()
 
         owner = owner.userhost()
+        max_items = config[const.OPT_MAX_ITEMS]
+        max_items = 0 if max_items == "max" else int(max_items)
 
         try:
             cursor.execute("""INSERT INTO nodes
@@ -304,7 +306,7 @@
                             config[const.OPT_ACCESS_MODEL],
                             config['pubsub#persist_items'],
                             config['pubsub#deliver_payloads'],
-                            int(config[const.OPT_MAX_ITEMS]),
+                            max_items,
                             config[const.OPT_OVERWRITE_POLICY],
                             config[const.OPT_SERIAL_IDS],
                             config[const.OPT_CONSISTENT_PUBLISHER],