Skip to content

Commit

Permalink
fix(ARCO-283): fix build and linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Nov 14, 2024
1 parent b3cddd5 commit cf3b643
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions internal/cache/in_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ func (s *MemoryStore) Get(key string) ([]byte, error) {
return nil, ErrCacheNotFound
}

bytes := value.([]byte)
bytes, ok := value.([]byte)
if !ok {
return nil, ErrCacheFailedToGet
}

return bytes, nil
}
Expand All @@ -41,9 +44,16 @@ func (s *MemoryStore) Del(keys ...string) error {
func (s *MemoryStore) GetAllWithPrefix(prefix string) (map[string][]byte, error) {
keys := make(map[string][]byte)
s.data.Range(func(k, v interface{}) bool {
key := k.(string)
key, ok := k.(string)
if !ok {
return false
}
if key[:len(prefix)] == prefix {
keys[key] = v.([]byte)
value, ok := v.([]byte)
if !ok {
return false
}
keys[key] = value
}
return true
})
Expand Down
2 changes: 1 addition & 1 deletion internal/metamorph/processor_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (p *Processor) getAllTransactionStatuses() (StatusUpdateMap, error) {

func (p *Processor) clearCache(updateStatusMap StatusUpdateMap) error {
keys := make([]string, len(updateStatusMap))
for k, _ := range updateStatusMap {
for k := range updateStatusMap {
keys = append(keys, CacheTxPrefix+k.String())
}

Expand Down

0 comments on commit cf3b643

Please sign in to comment.