# Can we get configurable ANNOUNCE_STREAM_MAXLENGTH?

_Help · started by flok on Sun, Oct 18, 2026 8:41 PM_

---

## Original post

**flok** · Sun, Oct 18, 2026 8:41 PM

Heyo, I see that my NomadNet is clearing old announces and maxes out at 256. I'd love to be able to increase this. I'm unsure if this is the right place to make feature requests, please direct me somewhere else if not :)

---

## Reply 1

**f24bcd7d** · Thu, Oct 22, 2026 10:01 PM

FYI I suck at programming, someone should probably fix this up a bit and maybe contribute it

that being said, here's a patch I wrote

(if anyone wants to use this, dedicated to the public domain under CC0. I prefer to remain anonymous)

```diff
diff --git a/nomadnet/Directory.py b/nomadnet/Directory.py
index 8727b7d..828788a 100644
--- a/nomadnet/Directory.py
+++ b/nomadnet/Directory.py
@@ -37,8 +37,6 @@ class PNAnnounceHandler:
             RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
 
 class Directory:
-    ANNOUNCE_STREAM_MAXLENGTH = 256
-
     aspect_filter = "nomadnetwork.node"
     @staticmethod
     def received_announce(destination_hash, announced_identity, app_data):
@@ -64,15 +62,20 @@ class Directory:
         return self._node_announces+self._peer_announces+self._pn_announces
 
     def _clean_node_announces(self):
-        while len(self._node_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        RNS.log(
+            f"Directory cleanup: count={len(self._node_announces)}, "
+            f"limit={self.app.announce_stream_maxlength}",
+            RNS.LOG_NOTICE
+        )
+        while len(self._node_announces) > self.app.announce_stream_maxlength:
             self._node_announces.pop()
 
     def _clean_peer_announces(self):
-        while len(self._peer_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        while len(self._peer_announces) > self.app.announce_stream_maxlength:
             self._peer_announces.pop()
 
     def _clean_pn_announces(self):
-        while len(self._pn_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        while len(self._pn_announces) > self.app.announce_stream_maxlength:
             self._pn_announces.pop()
 
     def __init__(self, app):
diff --git a/nomadnet/NomadNetworkApp.py b/nomadnet/NomadNetworkApp.py
index b32a4e2..5a8d091 100644
--- a/nomadnet/NomadNetworkApp.py
+++ b/nomadnet/NomadNetworkApp.py
@@ -1033,6 +1033,10 @@ class NomadNetworkApp:
                     if value == "web":
                         self.uimode = nomadnet.ui.UI_WEB
 
+                if option == "announce_stream_maxlength":
+                    value = self.config["client"].as_int(option)
+                    self.announce_stream_maxlength = value
+
         if not "utilities" in self.config:
             self.config["utilities"] = {}
         if not "enable_utilities" in self.config["utilities"]:
```

---

## Reply 2

**f24bcd7d** · Thu, Oct 22, 2026 10:02 PM

PS: I tested it and it seems to work, but it might have gaping holes I haven't noticed. quadruple check this before applying it to your nomadnet

---

## Reply 3

**f24bcd7d** · Fri, Oct 23, 2026 6:04 AM

here's a slightly better version of that patch:

```diff
diff --git a/nomadnet/Directory.py b/nomadnet/Directory.py
index 8727b7d..a3f94e4 100644
--- a/nomadnet/Directory.py
+++ b/nomadnet/Directory.py
@@ -37,8 +37,6 @@ class PNAnnounceHandler:
             RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
 
 class Directory:
-    ANNOUNCE_STREAM_MAXLENGTH = 256
-
     aspect_filter = "nomadnetwork.node"
     @staticmethod
     def received_announce(destination_hash, announced_identity, app_data):
@@ -64,15 +62,15 @@ class Directory:
         return self._node_announces+self._peer_announces+self._pn_announces
 
     def _clean_node_announces(self):
-        while len(self._node_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        while len(self._node_announces) > self.app.announce_stream_maxlength:
             self._node_announces.pop()
 
     def _clean_peer_announces(self):
-        while len(self._peer_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        while len(self._peer_announces) > self.app.announce_stream_maxlength:
             self._peer_announces.pop()
 
     def _clean_pn_announces(self):
-        while len(self._pn_announces) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
+        while len(self._pn_announces) > self.app.announce_stream_maxlength:
             self._pn_announces.pop()
 
     def __init__(self, app):
diff --git a/nomadnet/NomadNetworkApp.py b/nomadnet/NomadNetworkApp.py
index b32a4e2..810ad70 100644
--- a/nomadnet/NomadNetworkApp.py
+++ b/nomadnet/NomadNetworkApp.py
@@ -1033,6 +1033,10 @@ class NomadNetworkApp:
                     if value == "web":
                         self.uimode = nomadnet.ui.UI_WEB
 
+                if option == "announce_stream_maxlength":
+                    value = self.config["client"].as_int(option)
+                    self.announce_stream_maxlength = max(1, value)
+
         if not "utilities" in self.config:
             self.config["utilities"] = {}
         if not "enable_utilities" in self.config["utilities"]:
```

I removed that debug log I added and ensured the announce length is at least positive

---

## Reply 4

**flok** · Wed, Oct 28, 2026 8:45 PM

sweet thx! Would be great to have this implemented upstream but I can't find information on how to make contributions :/

---

## Reply 5

**Zenith** · Wed, Oct 28, 2026 10:00 PM

**flok** wrote:
> sweet thx! Would be great to have this implemented upstream but I can't find information on how to make contributions :/

I have this planned already in the codebase for my Web UI fork so if that gets accepted upstream it will be in base NomadNet

---
