add queued gateway admission and finish admin monitoring

This commit is contained in:
wlx committed 2026-09-27 02:58:16 +08:00
1 parent 8f75ebdf96
commit 0e6fca81b3
12 files changed
+288 -35

No files matched your search

@@ -45,6 +45,8 @@ moyi:
reads-per-minute: ${GATEWAY_READS_PER_MINUTE:300}
default-model-concurrency: ${GATEWAY_DEFAULT_MODEL_CONCURRENCY:4}
default-key-concurrency: ${GATEWAY_DEFAULT_KEY_CONCURRENCY:4}
queue-wait-ms: ${GATEWAY_QUEUE_WAIT_MS:30000}
queue-poll-ms: ${GATEWAY_QUEUE_POLL_MS:100}
tasks:
max-queued-per-model: ${TASK_MAX_QUEUED_PER_MODEL:100}
worker-interval-ms: ${MOYI_TASK_WORKER_INTERVAL_MS:1000}
@@ -0,0 +1,11 @@
local time = redis.call('TIME')
local now = tonumber(time[1]) * 1000 + math.floor(tonumber(time[2]) / 1000)
redis.call('ZREMRANGEBYSCORE', KEYS[1], '-inf', now)
redis.call('ZREMRANGEBYSCORE', KEYS[2], '-inf', now)
if redis.call('ZCARD', KEYS[1]) >= tonumber(ARGV[1]) then return 0 end
if redis.call('ZCARD', KEYS[2]) >= tonumber(ARGV[2]) then return 0 end
redis.call('ZADD', KEYS[1], now + tonumber(ARGV[3]), ARGV[4])
redis.call('ZADD', KEYS[2], now + tonumber(ARGV[3]), ARGV[4])
redis.call('PEXPIRE', KEYS[1], ARGV[3])
redis.call('PEXPIRE', KEYS[2], ARGV[3])
return 1