[+] Regular async test

This commit is contained in:
Charles Le Maux 2024-09-06 17:33:46 +02:00
parent bcf096cda2
commit aa792183ab

View File

@ -1,7 +1,4 @@
import time
from os import remove
import file_manager
import asyncio
import firebase_manager
@ -13,11 +10,37 @@ def ban_user(user_id: str):
print("Error banning user " + user_id, "|", str(e), type(e).__name__)
async def one(nb: int) -> int:
return 1
async def two(nb: int) -> int:
await asyncio.sleep(2)
return 2
async def three(nb: int) -> int:
await asyncio.sleep(3)
return 3
coroutines = [
two(1),one(0),three(2),
]
async def main() -> None:
results = await asyncio.gather(*coroutines)
#for result in results:
# print(result)
print(f"0: {results[0]}")
print(f"1: {results[1]}")
print(f"2: {results[2]}")
if __name__ == '__main__':
#ban_user("MpkbDMOO8PQddQgB5VgBQdTMWF53")
#file_manager.log_action("gqZN3eCHF3V2er3Py3rlgk8u2t83", "test", "DeleteServer")
#firebase_manager.set_servers_not_running()
test: list[int] = [0, 987]
test.remove(85)
print(test)
pass
asyncio.run(main())