Skip to content

Commit

Permalink
Use unlink, not del, for performance (#4449)
Browse files Browse the repository at this point in the history
* Use `unlink`, not `del`, for performance

* issue no.
  • Loading branch information
mperham committed Feb 5, 2020
1 parent d35c934 commit e44d5b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes.md
Expand Up @@ -6,6 +6,7 @@ HEAD
---------

- Fix broken Web UI response when using NewRelic and Rack 2.1.2+. [#4440]
- Update APIs to use `UNLINK`, not `DEL`. [#4449]

6.0.4
---------
Expand Down
4 changes: 2 additions & 2 deletions lib/sidekiq/api.rb
Expand Up @@ -273,7 +273,7 @@ def find_job(jid)
def clear
Sidekiq.redis do |conn|
conn.multi do
conn.del(@rname)
conn.unlink(@rname)
conn.srem("queues", name)
end
end
Expand Down Expand Up @@ -562,7 +562,7 @@ def scan(match, count = 100)

def clear
Sidekiq.redis do |conn|
conn.del(name)
conn.unlink(name)
end
end
alias_method :💣, :clear
Expand Down
4 changes: 2 additions & 2 deletions lib/sidekiq/launcher.rb
Expand Up @@ -83,7 +83,7 @@ def clear_heartbeat
Sidekiq.redis do |conn|
conn.pipelined do
conn.srem("processes", identity)
conn.del("#{identity}:workers")
conn.unlink("#{identity}:workers")
end
end
rescue
Expand Down Expand Up @@ -118,7 +118,7 @@ def ❤
conn.incrby("stat:failed:#{nowdate}", fails)
conn.expire("stat:failed:#{nowdate}", STATS_TTL)

conn.del(workers_key)
conn.unlink(workers_key)
curstate.each_pair do |tid, hash|
conn.hset(workers_key, tid, Sidekiq.dump_json(hash))
end
Expand Down

0 comments on commit e44d5b8

Please sign in to comment.