matched_queues = @redis.keys("*/sched/#{queue}*")
why not match */sched/*/ready ?
got it. A newer has committed.
matched_queues.each do |mq|
user_queues << "#{mq}"
end
- end
- user_queues = Set.new(user_queues)
- user_queues = user_queues.map do |queue|
if queue =~ /sched\/(.+)\/ready$/
$1
else
""
end
- end
- user_queues.reject!(&.empty?)
this way how to use priority
No priority now, can see my newer TODO.
Thanks, RenWen
Thanks, Shenwei
return rand_queues(user_queues) end
def get_job_from_queues(queues, testbox)
diff --git a/src/scheduler/redis_client.cr b/src/scheduler/redis_client.cr index b816d67..1253108 100644 --- a/src/scheduler/redis_client.cr +++ b/src/scheduler/redis_client.cr @@ -16,6 +16,10 @@ class Redis::Client @client = Redis::PooledClient.new(host: host, port: port, pool_size: 25, pool_timeout: 0.01) end
- def keys(pattern)
- @client.keys(pattern)
- end
- def hash_set(key : String, field, value) @client.hset(key, field.to_s, value.to_s) end
-- 2.23.0