Optimize Request#extras, refs #1148.

pull/1149/head
Sutra Zhou 11 months ago
parent 95d1f44150
commit e4ab6e27e4

@ -102,7 +102,7 @@ public class RedisPriorityScheduler extends RedisScheduler {
} }
private void setExtrasInItem(Jedis jedis,Request request, Task task) { private void setExtrasInItem(Jedis jedis,Request request, Task task) {
if (request.getExtras() != null) { if (!request.getExtras().isEmpty()) {
String field = DigestUtils.sha1Hex(request.getUrl()); String field = DigestUtils.sha1Hex(request.getUrl());
String value = JSON.toJSONString(request); String value = JSON.toJSONString(request);
jedis.hset(getItemKey(task), field, value); jedis.hset(getItemKey(task), field, value);

@ -84,7 +84,7 @@ public class RedisScheduler extends DuplicateRemovedScheduler implements Monitor
return true; return true;
} }
if (request.getExtras() != null && !request.getExtras().isEmpty()) { if (!request.getExtras().isEmpty()) {
return true; return true;
} }
if (request.getPriority() != 0L) { if (request.getPriority() != 0L) {

Loading…
Cancel
Save