Fix transaction IDs in transaction cache have global scope (#772)

This commit is contained in:
Alex Chen 2019-08-06 23:33:53 +08:00 committed by GitHub
parent 83f8e05032
commit 66bf615360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 13 deletions

View file

@ -50,7 +50,7 @@ func SendEvent(
) util.JSONResponse {
if txnID != nil {
// Try to fetch response from transactionsCache
if res, ok := txnCache.FetchTransaction(*txnID); ok {
if res, ok := txnCache.FetchTransaction(device.AccessToken, *txnID); ok {
return *res
}
}
@ -83,7 +83,7 @@ func SendEvent(
}
// Add response to transactionsCache
if txnID != nil {
txnCache.AddTransaction(*txnID, &res)
txnCache.AddTransaction(device.AccessToken, *txnID, &res)
}
return res