| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
When trying to call mget in Redis without any
parameters, a Redis error is thrown. To avoid
this, we circumvent Redis entirely when there
are no key names given.
|
|
|
|
| |
Related to 287920ca7d06c8f51198ec750d65ba703835b257
|
|
|
|
|
|
|
|
| |
Both methods were introduced in Ruby 2.5 and fit this use case very
nicely: listing a directory's entries excluding the "." and ".." nodes.
The private method #exclude_from was removed as it no longer serves
its original purpose.
|
|
|
|
|
| |
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
|
|\
| |
| | |
Preserve key order of #fetch_multi
|
| |
| |
| |
| |
| |
| | |
fetch_multi(*names) now returns its results in the same order
as the `*names` requested, rather than returning cache hits
followed by cache misses.
|
|/
|
|
|
|
|
|
|
|
| |
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).
I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two main reasons why `assert_called_with` should require
`args` argument:
1) If we want to assert that some method should be called and we don't
need to check with which arguments it should be called then we should use
`assert_called`.
2) `assert_called_with` without `args` argument doesn't assert anything!
```ruby
assert_called_with(@object, :increment) do
@object.decrement
end
```
It causes false assertions in tests that could cause regressions in the project.
I found this bug by working on
[minitest-mock_expectations](https://github.com/bogdanvlviv/minitest-mock_expectations) gem.
This gem is an extension for minitest that provides almost the same method call
assertions.
I was wondering whether you would consider adding "minitest-mock_expectations"
to `rails/rails` instead of private `ActiveSupport::Testing::MethodCallAssertions` module.
If yes, I'll send a patch - https://github.com/bogdanvlviv/rails/commit/a970ecc42c3a9637947599f2c13e3762e4b59208
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.
```ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "benchmark-ips"
end
Benchmark.ips do |x|
x.report('+@') { +"" }
x.report('dup') { "".dup }
x.compare!
end
```
```
$ ruby -v benchmark.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Warming up --------------------------------------
+@ 282.289k i/100ms
dup 187.638k i/100ms
Calculating -------------------------------------
+@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s
dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s
Comparison:
+@: 6775299.3 i/s
dup: 3320400.7 i/s - 2.04x slower
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* test case for fetch cache miss with skip_nil
* abondon nil cache if skip_nil specified
* ensure not cache key for skip nil
* add document with skip_nil for Store#fetch
* add a new change log entry for #25437
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use attr_reader/attr_writer instead of methods
method is 12% slower
Use flat_map over map.flatten(1)
flatten is 66% slower
Use hash[]= instead of hash.merge! with single arguments
merge! is 166% slower
See https://github.com/rails/rails/pull/32337 for more conversation
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Firstly, increment and decrement shouldn't care about the particulars of
key expiry. They should only know that they have to pass that responsibility
on to somewhere else.
Secondly, it moves the key normalization back inside the instrumentation like
it was originally. I think that matches the original design intention or at
the very least it lets users catch haywire key truncation.
Thirdly, it moves the changelog entry to the top of the file, where new entries
go. I couldn't understand what the entry was saying so I tried to rewrite it.
|
| |
|
| |
|
|
|
|
| |
Follow up of #32605.
|
|
|
|
| |
when connection_pool is not installed.
|
|
|
|
|
|
|
|
|
| |
This commit fix pattern of filenames for `CustomCops/AssertNot` and
`CustomCops/RefuteNot`.
rubocop should check every file under `test/`.
Related to #32441, #32605
|
|
|
|
|
| |
This autocorrects the violations after adding a custom cop in
3305c78dcd.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ruby 2.6.0 warns about this.
``` ruby -v
ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux]
```
Before, see:
https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264
https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174
|
|
|
|
|
|
|
|
|
|
| |
Namespace not working in RedisCacheStore#clear method. Bacause
namespace = merged_options(options)[namespace]
is always nil, Correct is
namespace = merged_options(options)[:namespace]
|
|
|
|
|
|
|
|
|
|
| |
`SecureRandom.byes` was added in Ruby 2.4. So, 5-2-stable build is broken
because using `SecureRandom.bytes`.
https://travis-ci.org/rails/rails/jobs/365740667
Also, `SecureRandom.byes` seems to an undocumented method.
If need random binary strings, should use `SecureRandom.random_bytes`.
https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb
|
|
|
|
| |
(See previous commit for a description of the issue)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Rails 5.2, when compression is enabled (which it is by default),
the actual value being written to the underlying storage is actually
_bigger_ than the uncompressed raw value.
This is because the `@marshaled_value` instance variable (typically)
gets serialized with the entry object, which is then written to the
underlying storage, essentially double-storing every value (once
uncompressed, once possibly compressed).
This regression was introduced in #32254.
|
| |
|
|
|
|
| |
It should returns raw value, not instance of `ActiveSupport::Cache::Entry`.
|
|
|
|
|
|
|
|
| |
Since `Redis#call` duck types as a Proc, we'd call `#call` on it,
thinking it's a Proc. Fixed by check for the Proc explicitly instead of
duck typing on `#call`.
References #32233
|
|
|
|
| |
Since Rails 6 requires Ruby 2.4.1+.
|
|
|
|
|
| |
Fixes #31909.
Closes #31911.
|
|\
| |
| |
| | |
Add support for connection pooling on RedisCacheStore
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
| |
Closes #31886
Fixes #31884
|
|
|
|
|
| |
This reverts commit ac74e2c521f6ddc0eac02d74a1313261bcc1d60f, reversing
changes made to ffdb06136152b3c5f7f4a93ca5928e16e755d228.
|
|
|
|
|
| |
This suppresses `Timeout::Error` exceptions.
Ref: https://travis-ci.org/rails/rails/jobs/334622442#L1089-L1110
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
config
|
| |
|
| |
|
|
|
|
| |
Update the long key handling test so it triggers truncation in the Redis cache store.
|
|
|
|
| |
currently it's not possible to know what the hit rates are from read_multi
|
| |
|
|
|
|
| |
Follow up of #31432.
|