File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 3
3
import org .mybatis .spring .annotation .MapperScan ;
4
4
import org .springframework .boot .SpringApplication ;
5
5
import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
+ import org .springframework .scheduling .annotation .EnableScheduling ;
6
7
import org .springframework .transaction .annotation .EnableTransactionManagement ;
7
8
8
9
/**
11
12
@ SpringBootApplication
12
13
@ EnableTransactionManagement
13
14
@ MapperScan ("com.cc.etherscan.io.mapper" )
15
+ @ EnableScheduling
14
16
public class EtherContractProcessorApplication {
15
17
16
18
public static void main (String [] args ) {
Original file line number Diff line number Diff line change 4
4
import com .cc .etherscan .io .processor .EthereumContractProcessor ;
5
5
import org .springframework .beans .factory .annotation .Value ;
6
6
import org .springframework .data .redis .core .RedisTemplate ;
7
+ import org .springframework .scheduling .annotation .Scheduled ;
7
8
import org .springframework .stereotype .Component ;
8
9
import us .codecraft .webmagic .Spider ;
9
10
10
- import javax .annotation .PostConstruct ;
11
11
import javax .annotation .Resource ;
12
12
13
13
/**
@@ -38,7 +38,7 @@ public class EtherEumSchedule {
38
38
@ Value ("${etherscan.intervalSeconds}" )
39
39
private int intervalSeconds = 4 ;
40
40
41
- @ PostConstruct
41
+ @ Scheduled ( cron = "0 0/2 * * * ?" )
42
42
public void start () {
43
43
for (int i = startPage ; i <= totalPage ; i ++) {
44
44
Spider .create (new EthereumContractProcessor (redisTemplate ))
Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ mybatis-plus:
40
40
map-underscore-to-camel-case : true
41
41
cache-enabled : false
42
42
etherscan :
43
- pageSize : 25
44
- startPage : 10
45
- totalPage : 1560
46
- threadCount : 5
47
- intervalSeconds : 4
43
+ pageSize : 10
44
+ startPage : 1
45
+ totalPage : 1
46
+ threadCount : 1
47
+ intervalSeconds : 1
You can’t perform that action at this time.
0 commit comments