Skip to content

Don't add a separator to global_keyprefix if it already has one#9080

Merged
thedrow merged 1 commit into
celery:mainfrom
naktinis:fix/prefix-with-no-separator
Jun 26, 2024
Merged

Don't add a separator to global_keyprefix if it already has one#9080
thedrow merged 1 commit into
celery:mainfrom
naktinis:fix/prefix-with-no-separator

Conversation

@naktinis

Copy link
Copy Markdown
Contributor

Description

Fixes: #9066

Currently an underscore is appended to result_backend_transport_options['global_keyprefix']. This has at least two downsides:

  1. the user cannot choose a separator, e.g. they may want to use : instead of _ (which is common in redis, for example)
  2. this doesn't match documentation, which indirectly implies that a user needs to include their preferred separator:
app.conf.result_backend_transport_options = {
    'global_keyprefix': 'my_prefix_'
}

Changes:

  • if the prefix ends with a separator (one of :_-.), use the prefix as is, otherwise append a _ separator for backward compatibility,
  • add tests for new behavior.

@codecov

codecov Bot commented Jun 18, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.00%. Comparing base (4c3e5a1) to head (05251a8).
Report is 110 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9080   +/-   ##
=======================================
  Coverage   78.00%   78.00%           
=======================================
  Files         150      150           
  Lines       18691    18693    +2     
  Branches     3192     3193    +1     
=======================================
+ Hits        14580    14582    +2     
  Misses       3813     3813           
  Partials      298      298           
Flag Coverage Δ
unittests 77.98% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@auvipy auvipy self-requested a review June 18, 2024 16:37
@thedrow thedrow merged commit 5073216 into celery:main Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Result backend configuration's global_keyprefix should not add an additional underscore

2 participants