File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
webmagic-extension/src/main/java/us/codecraft/webmagic/scheduler Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ public RedisScheduler(String host) {
2929 pool = new JedisPool (new JedisPoolConfig (), host );
3030 }
3131
32+ public RedisScheduler (JedisPool pool ) {
33+ this .pool = pool ;
34+ }
35+
3236 @ Override
3337 public synchronized void push (Request request , Task task ) {
3438 Jedis jedis = pool .getResource ();
@@ -59,7 +63,7 @@ public synchronized Request poll(Task task) {
5963 }
6064 String key = ITEM_PREFIX + task .getUUID ();
6165 String field = DigestUtils .shaHex (url );
62- byte [] bytes = jedis .hget (key .getBytes (),field .getBytes ());
66+ byte [] bytes = jedis .hget (key .getBytes (), field .getBytes ());
6367 if (bytes != null ) {
6468 Request o = JSON .parseObject (new String (bytes ), Request .class );
6569 return o ;
You can’t perform that action at this time.
0 commit comments