Add regular pending invite mapping checks

This commit is contained in:
Maxime Dor
2017-09-13 01:35:11 +02:00
parent 548dace78c
commit 222f7f104a

View File

@@ -79,6 +79,7 @@ public class InvitationManager {
private CloseableHttpClient client; private CloseableHttpClient client;
private Gson gson; private Gson gson;
private Timer refreshTimer;
@PostConstruct @PostConstruct
private void postConstruct() { private void postConstruct() {
@@ -94,6 +95,18 @@ public class InvitationManager {
// FIXME do better... // FIXME do better...
throw new RuntimeException(e); throw new RuntimeException(e);
} }
refreshTimer = new Timer();
refreshTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
try {
lookupMappingsForInvites();
} catch (Throwable t) {
log.error("Error when running background mapping refresh", t);
}
}
}, 5000L, TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES)); // FIXME make configurable
} }
@PreDestroy @PreDestroy