diff --git a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/api/MemberResource.java b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/api/MemberResource.java index 08d3620..7288a21 100644 --- a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/api/MemberResource.java +++ b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/api/MemberResource.java @@ -73,6 +73,7 @@ public Response finishLogin() { public Response getUserInfo(@DefaultValue("false") @QueryParam("refresh") boolean refresh) { if (refresh) { AdminDataCache.KNOWN_USER.invalidate(session.login()); + AdminDataCache.COMMONHAUS_DATA.invalidate(CommonhausDatastore.getKey(session)); session.userIsKnown(ctx); } diff --git a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/CommonhausDatastore.java b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/CommonhausDatastore.java index 4f6caef..29b962d 100644 --- a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/CommonhausDatastore.java +++ b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/CommonhausDatastore.java @@ -104,7 +104,7 @@ public CommonhausUser setCommonhausUser(CommonhausUser user, Set roles, */ @ConsumeEvent(value = READ) public Uni fetchCommonhausUser(QueryEvent event) { - final String key = event.login() + ":" + event.id(); + final String key = getKey(event); CommonhausUser result = event.refresh() ? null @@ -141,7 +141,7 @@ public Uni fetchCommonhausUser(QueryEvent event) { @ConsumeEvent(value = WRITE) public Uni pushCommonhausUser(UpdateEvent event) { final CommonhausUser user = event.user(); - final String key = user.login() + ":" + user.id(); + final String key = getKey(user); CommonhausUser result; ScopedQueryContext qc = ctx.getDatastoreContext(); @@ -241,4 +241,16 @@ private CommonhausUser deepCopy(CommonhausUser user) { private String dataPath(long id) { return "data/users/" + id + ".yaml"; } + + public static String getKey(QueryEvent event) { + return event.login() + ":" + event.id(); + } + + public static String getKey(CommonhausUser user) { + return user.login() + ":" + user.id(); + } + + public static String getKey(MemberSession session) { + return session.login() + ":" + session.nodeId(); + } }