commit d90666a206d14095d1b9d53642c2711a96f4cac4
parent e03588e29e0d6a8ab5371047c8e8bd8e99e7e1d1
Author: William Casarin <jb55@jb55.com>
Date: Mon, 9 Dec 2024 13:49:35 -0800
mem: reduce default queue size
This was overkill and was using lots of memory
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/nostrdb.c b/src/nostrdb.c
@@ -41,8 +41,7 @@
#define MAX_FILTERS 16
// the maximum size of inbox queues
-static const int DEFAULT_QUEUE_SIZE = 1000000;
-
+static const int DEFAULT_QUEUE_SIZE = 32768;
// increase if we need bigger filters
#define NDB_FILTER_PAGES 64
@@ -6654,7 +6653,7 @@ uint64_t ndb_subscribe(struct ndb *ndb, struct ndb_filter *filters, int num_filt
return 0;
// 500k ought to be enough for anyone
- buflen = sizeof(uint64_t) * 65536;
+ buflen = sizeof(uint64_t) * DEFAULT_QUEUE_SIZE;
buf = malloc(buflen);
if (!prot_queue_init(&sub->inbox, buf, buflen, sizeof(uint64_t))) {