Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created November 19, 2020 01:26
Show Gist options
  • Save matiasinsaurralde/149c667bf09d0e5e5bd74ecc47b47a41 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/149c667bf09d0e5e5bd74ecc47b47a41 to your computer and use it in GitHub Desktop.
patch
% git diff gateway/rpc_storage_handler.go
diff --git a/gateway/rpc_storage_handler.go b/gateway/rpc_storage_handler.go
index a4006875..d1cb0c85 100644
--- a/gateway/rpc_storage_handler.go
+++ b/gateway/rpc_storage_handler.go
@@ -786,7 +786,7 @@ func (r *RPCStorageHandler) CheckForKeyspaceChanges(orgId string) {
if len(keys.([]string)) > 0 {
log.Info("Keyspace changes detected, updating local cache")
- go r.ProcessKeySpaceChanges(keys.([]string))
+ go r.ProcessKeySpaceChanges(keys.([]string), orgId)
}
}
@@ -800,7 +800,7 @@ func getSessionAndCreate(keyName string, r *RPCStorageHandler) {
}
}
-func (r *RPCStorageHandler) ProcessKeySpaceChanges(keys []string) {
+func (r *RPCStorageHandler) ProcessKeySpaceChanges(keys []string, orgID string) {
keysToReset := map[string]bool{}
TokensToBeRevoked := map[string]string{}
ClientsToBeRevoked := map[string]string{}
@@ -874,8 +874,9 @@ func (r *RPCStorageHandler) ProcessKeySpaceChanges(keys []string) {
handleDeleteHashedKey(splitKeys[0], "", resetQuota)
getSessionAndCreate(splitKeys[0], r)
} else {
- log.Info("--> removing cached key: ", key)
handleDeleteKey(key, "-1", resetQuota)
+ keyWithOrg := generateToken(orgID, key)
+ handleDeleteKey(keyWithOrg, "-1", resetQuota)
getSessionAndCreate(splitKeys[0], r)
}
SessionCache.Delete(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment