[redis] More connection pooling changes

This commit is contained in:
Fosco Marotto
2021-01-17 17:36:20 -05:00
parent d2d381eb90
commit 002441af1f
11 changed files with 89 additions and 49 deletions

View File

@@ -34,7 +34,9 @@ class EditStatusService < BaseService
postprocess_status!
create_revision! revision_text
redis.setex(idempotency_key, 3_600, @status.id) if idempotency_given?
redis.with do |conn|
conn.setex(idempotency_key, 3_600, @status.id) if idempotency_given?
end
@status
end
@@ -91,7 +93,7 @@ class EditStatusService < BaseService
end
def validate_links!
raise GabSocial::NotPermittedError if LinkBlock.block?(@text)
raise GabSocial::LinkBlockedError if LinkBlock.block?(@text)
end
def language_from_option(str)
@@ -119,7 +121,10 @@ class EditStatusService < BaseService
end
def idempotency_duplicate?
@idempotency_duplicate = redis.get(idempotency_key)
redis.with do |conn|
@idempotency_duplicate = conn.get(idempotency_key)
end
@idempotency_duplicate
end
def status_attributes