Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: task ID and persistence discrepancy #48

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions silverback/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ def resolve_task(message: TaskiqMessage) -> Tuple[str, Optional[int], Optional[i
if task_id == "block":
block_number = message.args[0].number
task_id = handler_id_block(block_number)
elif task_id == "event":
elif "event" in task_id:
block_number = message.args[0].block_number
log_index = message.args[0].log_index
task_id = handler_id_event(message.args[0].address, message.args[0].abi.name)
# TODO: Should standardize on event signature here instead of name in case of overloading
task_id = handler_id_event(message.args[0].contract_address, message.args[0].event_name)

return task_id, block_number, log_index

Expand Down
2 changes: 1 addition & 1 deletion silverback/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ def handler_id_block(block_number: Optional[int]) -> str:
def handler_id_event(contract_address: Optional[str], event_signature: str) -> str:
"""Return a unique handler ID string for an event"""
# TODO: Under what circumstance can address be None?
return f"event/{contract_address or 'unknown'}/{event_signature}"
return f"{contract_address or 'unknown'}/event/{event_signature}"