Some checks failed
Deploy Production Server / if_merged (pull_request) Failing after 2m31s
24 lines
638 B
Java
24 lines
638 B
Java
package fr.titionfire.ffsaf.domain.service;
|
|
|
|
import jakarta.enterprise.context.ApplicationScoped;
|
|
|
|
import java.util.HashMap;
|
|
|
|
@ApplicationScoped
|
|
public class UpdateService { // For public result page
|
|
static HashMap<Long, Long> lastUpdate = new HashMap<>();
|
|
|
|
public void setNewData(long id) {
|
|
lastUpdate.put(id, System.currentTimeMillis());
|
|
}
|
|
|
|
public boolean needUpdate(long id, long last_update) {
|
|
if (!lastUpdate.containsKey(id)) {
|
|
lastUpdate.put(id, System.currentTimeMillis() - 5000);
|
|
return true;
|
|
}
|
|
|
|
return lastUpdate.getOrDefault(id, 0L) > last_update;
|
|
}
|
|
}
|