This commit is contained in:
parent
d6c8221223
commit
9f763ae4ce
@ -34,19 +34,19 @@ steps:
|
|||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
host:
|
host:
|
||||||
- 148.135.109.242
|
- 8.134.220.69
|
||||||
username: root
|
username: ching
|
||||||
key:
|
key:
|
||||||
from_secret: ssh_key
|
from_secret: ssh_key
|
||||||
passphrase:
|
passphrase:
|
||||||
from_secret: ssh_passphrase
|
from_secret: ssh_passphrase
|
||||||
port: 22
|
port: 45348
|
||||||
command_timeout: 2m
|
command_timeout: 2m
|
||||||
script:
|
script:
|
||||||
- echo "Pull new image"
|
- echo "Pull new image"
|
||||||
- docker pull git.tunpok.com/ching/grocy-barcode-helper:latest
|
- docker pull git.tunpok.com/ching/grocy-barcode-helper:latest
|
||||||
- echo "Go to the project directory"
|
- echo "Go to the project directory"
|
||||||
- cd /root/develop/grocy-barcode-helper
|
- cd /home/ching/dev/grocy-barcode-helper
|
||||||
- echo "Restart the container"
|
- echo "Restart the container"
|
||||||
- docker-compose down && docker-compose up -d
|
- docker-compose down && docker-compose up -d
|
||||||
|
|
||||||
|
|||||||
4
app.py
4
app.py
@ -371,7 +371,7 @@ create_consumer_group()
|
|||||||
def consume_stream():
|
def consume_stream():
|
||||||
try:
|
try:
|
||||||
# 读取 Stream 中的消息,设置阻塞时间为 0
|
# 读取 Stream 中的消息,设置阻塞时间为 0
|
||||||
messages = r.xreadgroup(CONSUMER_GROUP, CONSUMER_NAME, {STREAM_KEY: '>'}, count=5, block=1000)
|
messages = r.xreadgroup(CONSUMER_GROUP, CONSUMER_NAME, {STREAM_KEY: '>'}, count=10, block=1000)
|
||||||
|
|
||||||
if messages:
|
if messages:
|
||||||
for stream, msgs in messages:
|
for stream, msgs in messages:
|
||||||
@ -392,7 +392,7 @@ def consume_stream():
|
|||||||
bark_push('商品添加失败', '条形码 %s' % msg['data'])
|
bark_push('商品添加失败', '条形码 %s' % msg['data'])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error consuming stream: {e}")
|
logger.exception(f"Error processing messages: {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
# TODO: 定时任务函数:从 Redis Stream 读取消费者组的未确认消息
|
# TODO: 定时任务函数:从 Redis Stream 读取消费者组的未确认消息
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user