Commit 8abf5de8 authored by michael.simon's avatar michael.simon
Browse files

add return to async update rest endpoint. also check for last failed

update.
parent 3b55cde6
......@@ -119,10 +119,15 @@ public class UserUpdateServiceImpl implements UserUpdateService, Serializable {
expireTime = Long.parseLong(appConfig.getConfigValue("async_userupdate_expire_time"));
}
if ((System.currentTimeMillis() - user.getLastUpdate().getTime()) < expireTime) {
if (((System.currentTimeMillis() - user.getLastUpdate().getTime()) < expireTime)) {
logger.info("Skipping async attributequery for {} with {}@{}", new Object[] {user.getEppn(),
user.getPersistentId(), user.getIdp().getEntityId()});
}
else if ((user.getLastFailedUpdate() != null) &&
(System.currentTimeMillis() - user.getLastFailedUpdate().getTime()) < expireTime) {
logger.info("Skipping async attributequery for {} with {}@{} (last failed)", new Object[] {user.getEppn(),
user.getPersistentId(), user.getIdp().getEntityId()});
}
else {
logger.info("Performing async attributequery for {} with {}@{}", new Object[] {user.getEppn(),
user.getPersistentId(), user.getIdp().getEntityId()});
......
package edu.kit.scc.webreg.rest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
......@@ -24,10 +25,14 @@ public class UserController {
@Path(value = "/update-async/{eppn}")
@Produces({"application/json"})
@GET
public void updateUserAsync(@PathParam("eppn") String eppn, @Context HttpServletRequest request)
public Map<String, String> updateUserAsync(@PathParam("eppn") String eppn, @Context HttpServletRequest request)
throws IOException, RestInterfaceException, ServletException {
userUpdateService.updateUserAsync(eppn, request.getLocalName());
Map<String, String> map = new HashMap<String, String>();
map.put("reuqest", "submitted");
return map;
}
@Path(value = "/update/{eppn}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment