-
Notifications
You must be signed in to change notification settings - Fork 0
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
TransferAssets payload size 설정 #56
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,30 +47,34 @@ def count_users(channel_id: str, raid_id: int): | |
|
||
@celery.task() | ||
def get_ranking_rewards( | ||
channel_id: str, raid_id: int, total_count: int, start_nonce: int | ||
channel_id: str, raid_id: int, total_count: int, start_nonce: int, size: int | ||
): | ||
offset = 0 | ||
size = 100 | ||
results: List[RankingRewardWithAgentDictionary] = [] | ||
payload_size = size | ||
while len(results) < total_count: | ||
try: | ||
result = data_provider_client.get_ranking_rewards( | ||
raid_id, NetworkType.MAIN, offset, size | ||
raid_id, NetworkType.MAIN, offset, payload_size | ||
) | ||
except Exception as e: | ||
client.chat_postMessage( | ||
channel=channel_id, | ||
text=f"failed to get rewards from {config.data_provider_url} exc: {e}", | ||
) | ||
raise e | ||
rewards = update_agent_address(result, raid_id, NetworkType.MAIN, offset, size) | ||
rewards = update_agent_address( | ||
result, raid_id, NetworkType.MAIN, offset, payload_size | ||
) | ||
results.extend(reward for reward in rewards if reward not in results) | ||
offset = len(results) | ||
size = min(size, total_count - offset) | ||
payload_size = min(payload_size, total_count - offset) | ||
with NamedTemporaryFile(suffix=".csv") as temp_file: | ||
file_name = temp_file.name | ||
write_ranking_rewards_csv(file_name, results, raid_id, start_nonce) | ||
result_format = f"world_boss_{raid_id}_{total_count}_{start_nonce}_result" | ||
write_ranking_rewards_csv(file_name, results, raid_id, start_nonce, size) | ||
result_format = ( | ||
f"world_boss_{raid_id}_{total_count}_{start_nonce}_{size}_result" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we save result csv with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there is a possibility that payload_size may change, left the size used when executing. |
||
) | ||
client.files_upload_v2( | ||
channels=channel_id, | ||
title=result_format, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int(i / size)
:i // size
also can do this 😃