fix: remove unused agent arg from App.poll
This commit is contained in:
@@ -41,7 +41,7 @@ class App:
|
|||||||
def append(self, tid: uuid.UUID, sender: Agent, content: str):
|
def append(self, tid: uuid.UUID, sender: Agent, content: str):
|
||||||
return ops.append_message(self.store, tid, sender, content)
|
return ops.append_message(self.store, tid, sender, content)
|
||||||
|
|
||||||
def poll(self, tid: uuid.UUID, agent: Agent, after_seq: int = 0):
|
def poll(self, tid: uuid.UUID, after_seq: int = 0) -> list:
|
||||||
return ops.list_messages(self.store, tid, after_seq)
|
return ops.list_messages(self.store, tid, after_seq)
|
||||||
|
|
||||||
def mark_read(self, tid: uuid.UUID, agent: Agent, seq: int) -> None:
|
def mark_read(self, tid: uuid.UUID, agent: Agent, seq: int) -> None:
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ def poll(thread_id: str, after_seq: int = 0) -> list[dict]:
|
|||||||
"""Poll messages in a thread after seq."""
|
"""Poll messages in a thread after seq."""
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
# poll doesn't need agent for cursor; use raw store list for simplicity
|
msgs = _app.poll(UUID(thread_id), after_seq)
|
||||||
msgs = _app.poll(UUID(thread_id), _app.get_or_create_agent("__poll__"), after_seq)
|
|
||||||
# filter out the dummy poll agent if it ever sent (it never does)
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"seq": m.seq,
|
"seq": m.seq,
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ def test_app_facade_with_memory():
|
|||||||
t = app.create_thread(alice, bob)
|
t = app.create_thread(alice, bob)
|
||||||
app.append(t.id, alice, "hello")
|
app.append(t.id, alice, "hello")
|
||||||
assert app.has_unread(t.id, bob) is True
|
assert app.has_unread(t.id, bob) is True
|
||||||
msgs = app.poll(t.id, bob)
|
msgs = app.poll(t.id)
|
||||||
assert len(msgs) == 1
|
assert len(msgs) == 1
|
||||||
app.mark_read(t.id, bob, msgs[0].seq)
|
app.mark_read(t.id, bob, msgs[0].seq)
|
||||||
assert app.has_unread(t.id, bob) is False
|
assert app.has_unread(t.id, bob) is False
|
||||||
|
|||||||
Reference in New Issue
Block a user