This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AlarmStatusChanged queue handler | |
AlarmStatusChanged(func (payload) { | |
var alarmKey := "{{.payload.UserID}}:{{.payload.AlarmID}}" | |
// Get last record from Redis | |
var lastInMemory := redis.HMGet(alarmKey, ["ChangedAt"]) | |
// If new record is coming | |
if (!lastInMemory || ChangedAt > lastInMemory.ChangedAt) { | |
// AlarmId is unique, there is updating each new status coming | |
redis.HMSet(alarmKey, [ | |
"AlarmID", payload.AlarmID, |
OlderNewer