02 2022 档案
摘要:取消协程执行 # 官网:https://docs.python.org/zh-cn/3/library/asyncio-task.html?highlight=cancel#asyncio.Task.cancel import asyncio # 取消协程执行 async def cancel_me
阅读全文
摘要:设置协程超时时间 import asyncio import async_timeout async def main(): try: async with async_timeout.timeout(1): await asyncio.sleep(1) # io操作 print('协程执行完成')
阅读全文
摘要:官网:https://docs.python.org/zh-cn/3/library/asyncio-eventloop.html?highlight=run_in_executor#id15 import asyncio import concurrent.futures def blocking
阅读全文
摘要:shell脚本 #!/bin/bash # 切割nginx日志 LOGS_DIR="/www/wwwlogs" NGX_PID=`cat /www/server/nginx/logs/nginx.pid` cd $LOGS_DIR && { # 获取当前目录下所有文件 for log_file in
阅读全文

浙公网安备 33010602011771号