Skip to content

Commit 41e6bb5

Browse files
committed
🧲 fix(perf): must now pass 'workgroup'... might refac Charge() for a way around this pattern
1 parent c6d6ad0 commit 41e6bb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎magnet/ic/field.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Charge:
3535
def __init__(self, server):
3636
self.server = server
3737

38-
async def on(self, category: str = 'no_category', stream: str = 'documents', create: bool = False):
38+
async def on(self, category: str = 'no_category', stream: str = 'documents', create: bool = False, workgroup: bool = False):
3939
"""
4040
Connects to the NATS server, creates a stream and category if they don't exist, and prints a success message.
4141
@@ -54,7 +54,7 @@ async def on(self, category: str = 'no_category', stream: str = 'documents', cre
5454
if self.stream not in [x.config.name for x in streams] or self.category not in sum([x.config.subjects for x in streams], []):
5555
try:
5656
if self.stream not in [x.config.name for x in streams]:
57-
_f("wait", f'creating {self.stream}'), await self.js.add_stream(name=self.stream, subjects=[self.category], retention='workqueue', num_replicas=3) \
57+
_f("wait", f'creating {self.stream}'), await self.js.add_stream(name=self.stream, subjects=[self.category], retention='workqueue' if workgroup else None, num_replicas=3) \
5858
if create else _f("warn", f"couldn't create {stream} on {self.server}")
5959
streams = await self.js.streams_info()
6060
if self.category not in sum([x.config.subjects for x in streams if x.config.name == self.stream], []):

0 commit comments

Comments
 (0)