Skip to content

Commit 918fc28

Browse files
committed
add scanIntervalCron config inject .
1 parent 9c55f68 commit 918fc28

File tree

7 files changed

+14
-6
lines changed

7 files changed

+14
-6
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
<profile>
128128
<id>tar-build</id>
129129
<build>
130+
<finalName>${project.artifactId}</finalName>
130131
<plugins>
131132
<plugin>
132133
<groupId>org.apache.maven.plugins</groupId>

src/main/java/com/cc/etherscan/io/schedule/EtherEumSchedule.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
import com.cc.etherscan.io.pipeline.EthereumPipeline;
55
import com.cc.etherscan.io.processor.EthereumContractProcessor;
66
import org.springframework.beans.factory.annotation.Value;
7+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
78
import org.springframework.data.redis.core.RedisTemplate;
9+
import org.springframework.scheduling.annotation.EnableScheduling;
810
import org.springframework.scheduling.annotation.Scheduled;
911
import org.springframework.stereotype.Component;
1012
import us.codecraft.webmagic.Spider;
1113

14+
import javax.annotation.PostConstruct;
1215
import javax.annotation.Resource;
1316

1417
/**
@@ -42,7 +45,8 @@ public class EtherEumSchedule {
4245
@Value("${etherscan.intervalSeconds}")
4346
private int intervalSeconds = 4;
4447

45-
@Scheduled(cron="${etherscan.scanIntervalCron}")
48+
//@Scheduled(cron="${etherscan.scanIntervalCron}")
49+
@PostConstruct
4650
public void start() {
4751
for (int i = startPage; i<= totalPage; i++) {
4852
Spider.create(new EthereumContractProcessor(redisTemplate, etherContractMapper))

src/main/resources/application-prod.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ spring:
22
redis:
33
host: 127.0.0.1
44
port: 10179
5+
password: 2aVzLk8jcmJHh8Xo
56
datasource:
67
url: jdbc:mysql://127.0.0.1:3307/esc?useUnicode=true&characterEncoding=utf8
78
username: esc
8-
password: esc
9+
password: d8Mo9u1JroPbKtXG

src/main/resources/application.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ mybatis-plus:
3939
configuration:
4040
map-underscore-to-camel-case: true
4141
cache-enabled: false
42+
scheduling:
43+
enabled: true
4244
etherscan:
4345
pageSize: 100
4446
startPage: 1

src/main/resources/assembly.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<directory>${project.build.directory}</directory>
2323
<outputDirectory>lib</outputDirectory>
2424
<includes>
25-
<include>${project.artifactId}-${project.version}.jar</include>
25+
<include>${project.artifactId}.jar</include>
2626
</includes>
2727
<fileMode>755</fileMode>
2828
</fileSet>

src/main/resources/db-changelog.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<property name="now" value="sysdate" dbms="mysql"/>
88

99
<!--原则上,这里只留下以项目模块为单位的include, 名字建议采用模块全名-->
10-
<!--<include file="classpath:changelog/ether-contract-changelog.xml"/>-->
10+
<include file="classpath:changelog/ether-contract-changelog.xml"/>
1111

1212

1313
</databaseChangeLog>

src/main/resources/logback.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</encoder>
77
</appender>
88
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
9-
<file>${APP_HOME}/logs/spider.log</file>
9+
<file>${APP_HOME}/logs/etherscan.log</file>
1010
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
11-
<fileNamePattern>${APP_HOME}/logs/spider.%i.log.zip</fileNamePattern>
11+
<fileNamePattern>${APP_HOME}/logs/etherscan.%i.log.zip</fileNamePattern>
1212
<minIndex>1</minIndex>
1313
<maxIndex>3</maxIndex>
1414
</rollingPolicy>

0 commit comments

Comments
 (0)