02 2022 档案

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