上一页 1 2 3 4 5 6 7 ··· 24 下一页
摘要: 取消协程执行 # 官网: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 阅读(91) 评论(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 阅读(710) 评论(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 阅读(65) 评论(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 阅读(48) 评论(0) 推荐(0)
摘要: 列表操作 # redis中的list操作命令中删除指定key中的所有记录命令: ltrim q_http_test 1 0 # 查看列表数据 LRANGE q_http_test 0 -1 阅读全文
posted @ 2022-01-22 14:58 LiShiChao 阅读(29) 评论(0) 推荐(0)
摘要: 官网介绍 https://pypi.org/project/grpclib/#example 准备环境 # python3安装 pip install grpcio==1.41.0 pip install grpcio-tools==1.41.0pip install grpclib # pypy3 阅读全文
posted @ 2022-01-19 13:08 LiShiChao 阅读(326) 评论(0) 推荐(0)
摘要: # 日志内容 2022-01-18 23:59:58,397 I 356615016 UserEnterRoom ok roomId= 120922 user= 1850158 userCount= 14 reconnect= False # 命令 awk 'BEGIN{max = 0}{if($1 阅读全文
posted @ 2022-01-19 11:32 LiShiChao 阅读(178) 评论(0) 推荐(0)
摘要: Future对象 官网:https://docs.python.org/zh-cn/3/library/asyncio-future.html?highlight=future#asyncio.Future 这个例子创建一个 Future 对象,创建和调度一个异步任务去设置 Future 结果,然后 阅读全文
posted @ 2022-01-09 07:24 LiShiChao 阅读(134) 评论(0) 推荐(0)
摘要: go run go run main.go 也可以执行程序,该命令本质上也是先编译再执行。 跨平台编译 # 编译Linux可执行文件 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o hello.linux-amd64.go # 编译Windows可 阅读全文
posted @ 2022-01-05 17:00 LiShiChao 阅读(55) 评论(0) 推荐(0)
摘要: 安装go # 下载二进制包 cd /usr/local/src/ wget https://golang.google.cn/dl/go1.17.5.linux-amd64.tar.gz tar xf go1.17.5.linux-amd64.tar.gz -C /usr/local/ # 加入环境 阅读全文
posted @ 2022-01-05 16:45 LiShiChao 阅读(366) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 24 下一页