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) {
29
29
pool = new JedisPool (new JedisPoolConfig (), host );
30
30
}
31
31
32
+ public RedisScheduler (JedisPool pool ) {
33
+ this .pool = pool ;
34
+ }
35
+
32
36
@ Override
33
37
public synchronized void push (Request request , Task task ) {
34
38
Jedis jedis = pool .getResource ();
@@ -59,7 +63,7 @@ public synchronized Request poll(Task task) {
59
63
}
60
64
String key = ITEM_PREFIX + task .getUUID ();
61
65
String field = DigestUtils .shaHex (url );
62
- byte [] bytes = jedis .hget (key .getBytes (),field .getBytes ());
66
+ byte [] bytes = jedis .hget (key .getBytes (), field .getBytes ());
63
67
if (bytes != null ) {
64
68
Request o = JSON .parseObject (new String (bytes ), Request .class );
65
69
return o ;
You can’t perform that action at this time.
0 commit comments