-
Notifications
You must be signed in to change notification settings - Fork 276
Reorders put method upload selection to use @transfer_manager first #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'll update the code to not use it tomorrow. Didn't even think of these older Rubies. Sorry. |
|
I need some feedback if the Shrine team wants me to attempt fix the Ruby 2.5 and 2.6 failures. They look like a dependent library is behaving differently. |
|
@hms I see where you're going with this, but we'd have to cut down on the formatting noise first. I was going to take a stab at it, but if you wanted to continue with it, that's fine by me. But we won't be able to merge with all the formatting changes so that would be a first step. |
|
Unfortunately fair. But to be honest, it would be helpful to have at least something to reference so I can configure my editor to honor this projects defaults. I guess I'll reimplement the PR using VIM to avoid unexpected reformatting. |
|
@hms Couldn't you temporarily disable format on write in your editor? Maybe add it to project-specific config? |
|
I switch over to ZED for Shrine and it's much less opinionated about formatting. My latest push is clean and only touches what I've changed to make the transaction_manager the default when it exists and your original code the fallback. hms |
|
Thanks for cleaning it up! I would personally prefer to keep everything in the Unfortunately, in recent ruby versions the S3 tests are segfaulting. AFAIR that's a regression in Ruby where |
|
I'm sorry for the kerfuffle around the formatting. I didn't even think about Rubymine and its "need" to "seamlessly change things". Normally I would not have split #put into 2 methods. My rational is that at some point in the future, the OG #put code actually has to disappear as those methods it is based on will disappear. That may be far enough into the future that you don't want to worry about that just yet and/or you'll cool with people locking the S3 Gem to a version that retains the deprecated APIs.
If the download functionality was also migrated to the transfer_manager, would Shrine still need the Down Gem? Also, just before giving up on tracing a bad bit of Shrine related memory bloat (possibly leak), it was starting to look like Down (only when using temp files) was the root cause. When I get a few minutes of free time, I'll try to reproduce those tests using the transfer_manager. Might be another reason to accelerate the full transition to the new API. hms |
Yes, among other reasons because Shrine uses more than just S3 storage adapters. But I too have been suspecting some memory issues in Down, although they may be just kind of unavoidable in ruby is also what I was maybe arriving at (the memory issues may not be particular to Down, but endemic to any attempt to copy large files in ruby). But I'm very curious as to what you may find, although it's not about this issue/PR, maybe open up a Discussion? |
|
@jrochkind Thanks for the gentle reminder that sometimes the problem is bigger than the one impacting me.... I really wasn't thinking outside of S3 at all. When I find the time to dig into Down again, I'll open up a ticket over there and reference it here. |
Just lacking free time. I'll try to look this weekend if it's not reviewed beforehand. |
|
The test failures are due to a change in On Ruby 2.5 & 2.6, you get aws-sdk-s3 1.188.0 but once you move to Ruby >= 2.7 you get aws-sdk-s3 1.202.0. On 1.202.0 SDK, the operations are: But on 1.188.0 SDK, the operations are: I hate to suggest it, but I think we should add in guards for the tests that are failing/had to be adjusted. We'll guard Example: it "does whatever" do
# New tests
end if RUBY_VERSION >= "2.7.0" # Because aws-sdk-s3 order of operations changed on newer Rubies
it "does whatever" do
# Old tests
end if RUBY_VERSION < "2.7.0" # Because aws-sdk-s3 order of operations changed on newer RubiesOnly for the failing tests. |
|
@adam12 Was that last comment addressed to me or Janko for approval? I'm happy to make the changes if that's what's holding things up. hms |
|
Sorry, I should have been more clear. I think the best path forward is versioning the tests by Ruby version. I don't see a better way, and we'll get the changes unblocked. So if you make those changes, we can get this PR merged. |
* s3.rb: undo splitting #put into multiple methods and instead handle new functionality via if * Update s3_test.rb to address API changes within S3 gem that are locked to versions of Ruby.
|
I appreciate the persistence, I'll try to get a new version released tomorrow 👍🏻 |
|
@janko Thank you for Shrine and keeping it alive despite ActiveStorage. |
Reorders put method to use @transfer_manager if defined and then fallback to existing (but soon to be deprecated code)
I did my best to maintain the code formatting, especially in the tests. But it was rather challenging given my Rubymine configuration had very, very ideas about formatting than the project does. I did my best to put things back by hand, but there were several area's where the changes were by spacing that did not show visually in Rubymine.