-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add counter to cache_id #1797
Add counter to cache_id #1797
Conversation
@@ -178,7 +189,9 @@ def workfile_path(for_file=original_filename) | |||
alias_method :full_original_filename, :original_filename | |||
|
|||
def cache_id=(cache_id) | |||
raise CarrierWave::InvalidParameter, "invalid cache id" unless cache_id =~ /\A[\d]+\-[\d]+\-[\d]{4}\z/ | |||
# Earlier cache_id contained only 3 pieces, the "counter" part was introduced later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to talk about later
. Change to "Earlier version used 3 part cache_id."
43c12a4
to
ae0a4be
Compare
|
||
class CacheCounter | ||
@@counter = 0 | ||
def self.increment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please insert a linebreak before this method definition.
Old version of generate_cache_id was collision-prone: for complex factories with multiple uploaders we had quite a few flaky specs because of that. With a counter, this (and similar situations like carrierwaveuploader#1232) should be resolved completely.
ae0a4be
to
3e989fc
Compare
@bensie can I get your thoughts on this? |
CI is failing on JRuby and Rails master, both of which are expected. |
Seems they are failing for quite a while, e.g. here I can see the same picture: https://travis-ci.org/carrierwaveuploader/carrierwave/builds/96401284 |
@stillwaiting yes, that was what I mean, that those cases also fail on |
GTTM @bensie |
@thomasfedb @stillwaiting The build should be 💚 now thanks to #1807. |
Add a counter to generated cache_id values to avoid collisions
@thomasfedb How about backporting? |
@mtsmfm I'm very happy to consider back porting this to the 0.10-stable branch, although we need to get the CI build fixed first. |
OK, I'll investigate that 😉 |
@mtsmfm should be good with #1847 cc @thomasfedb. |
@mehlah Thanks for letting me know 😄 |
------------------ Add counter to cache_id Old version of generate_cache_id was collision-prone: for complex factories with multiple uploaders we had quite a few flaky specs because of that. With a counter, this (and similar situations like carrierwaveuploader#1232) should be resolved completely.
------------------ Add counter to cache_id Old version of generate_cache_id was collision-prone: for complex factories with multiple uploaders we had quite a few flaky specs because of that. With a counter, this (and similar situations like carrierwaveuploader#1232) should be resolved completely.
Backport cache counter_id (#1797) to 0.11-stable
Current (in master) version of generate_cache_id is collision-prone: for complex factories with multiple
uploaders we have quite a few flaky specs because of that. Having a counter, this and similar situations, like mentioned here, should be resolved completely.