Add abi_name and subscriptions_type tags.

Add-moonworm-tasks-to-journal
Andrey Dolgolev 2021-12-07 16:08:51 +02:00
rodzic e5b3642f5c
commit 97713c0b51
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -479,6 +479,7 @@ def get_all_entries_from_search(
def apply_moonworm_tasks(
subscription_type: str,
abi: Any,
address: str,
) -> None:
@ -491,7 +492,7 @@ def apply_moonworm_tasks(
try:
entries = get_all_entries_from_search(
journal_id=MOONSTREAM_MOONWORM_TASKS_JOURNAL,
search_query=f"tag:address:{address}",
search_query=f"tag:address:{address} tag:subscription_type:{subscription_type}",
limit=100,
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
)
@ -521,6 +522,8 @@ def apply_moonworm_tasks(
f"address:{address}",
f"type:{abi_hashes_dict[hash]['type']}",
f"abi_metod_hash:{hash}",
f"subscription_type:{subscription_type}",
f"abi_name:{abi_hashes_dict[hash]['name']}",
f"status:active",
],
}

Wyświetl plik

@ -143,6 +143,7 @@ async def add_subscription_handler(
background_tasks.add_task(
apply_moonworm_tasks,
subscription_type_id,
json_abi,
address,
)
@ -309,6 +310,7 @@ async def update_subscriptions_handler(
if abi:
background_tasks.add_task(
apply_moonworm_tasks,
subscription_resource.resource_data["subscription_type_id"],
json_abi,
subscription_resource.resource_data["address"],
)