Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改事件过期时间单位和webhook通知级别 #1185

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,25 @@ public class MemoryClientImpl implements EventDao {
*/
public MemoryClientImpl(BackendConfig backendConfig) {
this.eventMap = ExpiringMap.builder().expiration(
backendConfig.getEventExpire(), TimeUnit.SECONDS)
backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.agentInstanceMap = ExpiringMap.builder()
.expiration(backendConfig.getEventExpire(), TimeUnit.SECONDS)
.expiration(backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.eventTimeKeyMap = ExpiringMap.builder()
.expiration(backendConfig.getEventExpire(), TimeUnit.SECONDS)
.expiration(backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.sessionMap = ExpiringMap.builder()
.expiration(backendConfig.getSessionTimeout(), TimeUnit.SECONDS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.emergency = ExpiringMap.builder()
.expiration(backendConfig.getEventExpire(), TimeUnit.SECONDS)
.expiration(backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.important = ExpiringMap.builder()
.expiration(backendConfig.getEventExpire(), TimeUnit.SECONDS)
.expiration(backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
this.normal = ExpiringMap.builder()
.expiration(backendConfig.getEventExpire(), TimeUnit.SECONDS)
.expiration(backendConfig.getEventExpire(), TimeUnit.DAYS)
.expirationPolicy(ExpirationPolicy.CREATED).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public QueryCacheSizeEntity getQueryCacheSize(EventsRequestEntity eventsRequestE
public void cleanOverDueEventTimerTask() {
if (backendConfig.getDatabase().equals(DatabaseType.REDIS)) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.SECOND, -backendConfig.getEventExpire());
calendar.add(Calendar.DATE, -backendConfig.getEventExpire());
List<Tuple> needCleanEvent = queryByTimeRange(
CommonConst.REDIS_EVENT_FIELD_SET_KEY, 0, calendar.getTimeInMillis());
List<String> eventKeys = needCleanEvent.stream().map(Tuple::getElement).collect(Collectors.toList());
Expand Down
8 changes: 5 additions & 3 deletions sermant-backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ database.password=
database.filter.thread.num=10000

# webhook level[EMERGENCY,IMPORTANT,NORMAL]
webhook.eventpush.level=NORMAL
webhook.eventpush.level=EMERGENCY

# Event Expiration Time (s)
database.event.expire=1800
# Event Expiration Time (day)
database.event.expire=7

# event field Expiration Time (s)
database.field.expire=5
database.fixedDelay=10000

Expand Down