Commit Graph

3512 Commits

Author SHA1 Message Date
Rafael França
fcb5f9035f
Merge pull request #39828 from tgxworld/backward_patches_for_time_floor_ceil
Add `Time#ceil` and `Time#floor` core extensions.
2020-10-30 16:01:55 -04:00
Eugene Kenny
9509bc23c2 Fixup test for TimeWithZone Time.at precision
This test doesn't involve a DateTime, and can be shortened a bit.
2020-10-30 12:35:03 +00:00
Eugene Kenny
a6636b0d1c
Merge pull request #40448 from BKSpurgeon/fix-timezone-rounding-bug
Fix: timezone bug - rounding problem
2020-10-30 12:00:55 +00:00
Rafael França
43daedcb7d
Merge pull request #39550 from vipulnsward/expiry-fix
Fix parsing of jsonified expiry date on AS::Message::Metadata for old json format
2020-10-29 21:47:40 -04:00
Rafael Mendonça França
2c6f5c0b8a
Remove deprecated methods in ActiveSupport::Multibyte::Unicode 2020-10-30 00:26:02 +00:00
Rafael Mendonça França
8f14d5ad4b
Remove deprecated ActiveSupport::Multibyte::Chars#consumes? and ActiveSupport::Multibyte::Chars#normalize 2020-10-30 00:26:01 +00:00
Rafael Mendonça França
96a0cb6938
Remove deprecated file active_support/core_ext/hash/transform_values 2020-10-30 00:25:58 +00:00
Rafael Mendonça França
36eebfe184
Remove deprecated file active_support/core_ext/hash/compact 2020-10-30 00:25:57 +00:00
Rafael Mendonça França
14cfb37083
Remove deprecated file active_support/core_ext/array/prepend_and_append 2020-10-30 00:25:56 +00:00
Rafael Mendonça França
959af4bfcb
Remove deprecated file active_support/core_ext/numeric/inquiry 2020-10-30 00:25:54 +00:00
Rafael Mendonça França
167b4153ca
Remove deprecated Module#parent_name, Module#parent and `Module#parents 2020-10-30 00:25:52 +00:00
Rafael Mendonça França
8d1ade40dd
Remove deprecated LoggerSilence constant 2020-10-30 00:25:50 +00:00
Rafael França
60546a0c23
Merge pull request #39718 from jonathanhefner/listen-on-fork
Listen on fork in EventedFileUpdateChecker
2020-10-29 17:39:13 -04:00
ojab
1edc61dff0
Remove keys from local_cache in RedisCacheStore#delete_matched
Fixes #38627
2020-10-27 17:03:22 +00:00
Akira Matsuda
b45b9ac05e before_save and after_save in this test class are defined as public methods 2020-10-27 12:13:32 +09:00
BK
0719b9412d Fix: timezone bug - rounding problem
Why this commit?

   TimeWithZone instances were unexpectedly being rounded up.

What changes were made and why?

   Internally, .to_f was being called on TimeWithZone instances.
This can lead to inaccuracies if Rationals are involved. Using .to_r
instead of .to_f will be more accurate, but it does come with a
slight computational cost.
2020-10-25 22:19:29 +11:00
Kir Shatrov
6fa747f294 Instrument cache store name 2020-10-21 22:44:14 +01:00
Rafael França
efaddc7262
Merge pull request #40419 from sambostock/handle-portless-memcache-servers
Handle port-less `$MEMCACHE_SERVERS` in `MemCacheStore` tests
2020-10-21 01:15:52 -04:00
Sam Bostock
85cde3cde1
Remove redundant arguments in store test helper
The store now uses $MEMCACHE_SERVERS and 127.0.0.1:11211 as fallbacks,
so there is no need to specify them them again.
2020-10-20 23:50:52 -04:00
Sam Bostock
e79364610c
Fallback to $MEMCACHE_SERVERS if no servers given
By default, Dalli has two fallbacks if no server addresses are given:

- $MEMCACHE_SERVERS
- "127.0.0.1:11211"

However, MemCacheStore does its own check for addresses, and falls back
to "localhost:11211" if none are present.

This can lead to bugs in migrations from the deprecated :dalli_store
(provided by the Dalli) to :mem_cache_store:

```diff
-config.cache_store = :dalli_store     # could be implicitly relying on $MEMCACHE_SERVERS
+config.cache_store = :mem_cache_store # ignores $MEMCACHE_SERVERS
```

By removing our own fallback and simply passing `nil` to Dalli::Client,
we get its fallback logic for free. Tests are added so we can detect if
this ever changes.
2020-10-20 23:50:52 -04:00
Sam Bostock
f50be302de
Add tests for :mem_cache_store initialization
This documents existing behavior ahead of changes.
2020-10-20 22:53:57 -04:00
Sam Bostock
944574872f
Refactor MemCacheStoreTest
- Remove unused instance variable
- Add client test helper
2020-10-20 22:53:26 -04:00
Sam Bostock
a812537e4d
Handle port-less $MEMCACHE_SERVERS in MemCacheStore tests
Devs may be running tests on a machine which provides $MEMCACHE_SERVERS
without a trailing port. We should allow for this when checking if
Memcache is working.
2020-10-20 22:32:22 -04:00
Jean Boussier
c4845aa779 Make AS::Cache coder configurable 2020-10-14 12:12:36 +02:00
Rafael Mendonça França
d98d749222
Revert "Merge pull request #39304 from zenspider/zenspider/backtrace_filter_should_never_return_empty"
This reverts commit 2eb7aa111bbbf69fe89bdcd96b4839480e2ac076, reversing
changes made to 0b28f0c39c5b0a0009f1ea9d13ce97704e20c85b.

Rails backtrace cleaner needs to be able to return empty traces to
separate application code from the framework code and not report
exceptions that happen inside only framework code.

See
345de17caf/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb (L72).
2020-10-06 22:31:41 +00:00
Akira Matsuda
702add649d to_ary should be defined as a public method 2020-10-02 15:53:47 +09:00
Akira Matsuda
14eb6b2794 ShareLock#exclusive and sharing are both public methods 2020-10-02 15:53:47 +09:00
Akira Matsuda
339151204d ShareLock#sharing and Object#tap are both public methods 2020-10-02 15:53:47 +09:00
Akira Matsuda
cc433d3a08 Class attribute writer is a public method 2020-10-02 15:53:46 +09:00
Akira Matsuda
494c0429b7 Inflections#plurals, singulars, uncountables, humans, acronyms are public attr_readers 2020-10-02 15:53:23 +09:00
Akira Matsuda
2b2ed7bc0e All these tested String methods are public 2020-10-02 15:52:09 +09:00
Akira Matsuda
8d3748166f String#capitalize downcase, lstrip, reverse, rstrip, swapcase, upcase are public methods 2020-10-02 15:52:09 +09:00
Akira Matsuda
034d6514e0 TimeWithZone#sunday?, monday?, tuesday?, ... are public methods 2020-10-02 15:52:09 +09:00
Akira Matsuda
0977da9b9b Integer#second, minute, hour, day, week, month, year are public methods 2020-10-02 15:52:09 +09:00
Akira Matsuda
e4874343e6 Logger#info, debug, etc. are public methods 2020-10-02 15:52:09 +09:00
Jonathan Hefner
eba1534939 Listen on fork in EventedFileUpdateChecker
The Listen gem does not notify across process forks, and so forked
processes must re-create their listeners.  `EventedFileUpdateChecker`
handled this in `updated?` by checking if `Process.pid` was different.
Because file updates may have occurred after the start of the fork but
before the call to `updated?`, `updated?` would always return true in
this case.

However, the above approach can result in unnecessary application
reloading, particularly when using Spring.  That, in turn, can cause
unexpected and problematic behavior: #39431, #37591.  This commit
changes listener re-creation to occur immediately after fork, and
changes `updated?` to return true only when necessary.
2020-09-26 16:35:28 -05:00
Jonathan Hefner
f8b9150f1c Eliminate EventedFileUpdateChecker::PathHelper 2020-09-26 16:11:11 -05:00
Jonathan Hefner
8e1e670adb Make EventedFileUpdateChecker garbage collectable
The Listen gem dispatches "file changed" events from a separate thread.
This thread holds a reference to the `changed` callback, and runs until
the listener is stopped.  Thus, objects that are part of the `changed`
callback's scope cannot be garbage collected until the listener is
stopped.

This commit isolates the `changed` callback and associated scope in an
`EventedFileUpdateChecker::Core` instance.  This ensures that the
`EventedFileUpdateChecker` instance can be garbage collected.
Additionally, this commit adds a finalizer to the
`EventedFileUpdateChecker` instance, which stops the listener and
ensures that the `EventedFileUpdateChecker::Core` instance can be
garbage collected.
2020-09-26 16:11:11 -05:00
bogdanvlviv
ac18d0bbda
Hash#extract!: Clarify its docs and assert remaining value in test_extract_nils
This change emphasizes a remaining value after applying `extract!` on
a hash.
2020-09-26 22:39:07 +03:00
Jonathan Hefner
6601acf268 Stop EventedFileUpdateChecker's listener only
When an `EventedFileUpdateChecker` instance detects a watched directory
that previously did not exist, it calls `shutdown!` and then `boot!` to
reinitialize its underlying listener.  Prior to this commit, `shutdown!`
invoked `Listen.stop` which stops **all** listeners, globally.  This
commit changes `shutdown!` to stop the checker's listener only.

Fixes #38174.
2020-09-25 13:44:51 -05:00
Jonathan Hefner
0fc7448fc5 Improve error when EncryptedFile key length wrong
When given a key of invalid length, OpenSSL::Cipher raises a "key must
be X bytes" error.  However, EncryptedFile keys are packed before they
are passed to OpenSSL::Cipher, so the actual length requirement is "2*X
characters".

This commit checks the key length, and raises a more helpful error if
the key length is invalid.

Closes #39528.
2020-09-24 19:45:11 -05:00
Adrianna Chang
387aa8c373 Subscriber.attach_to with inherit_all option 2020-09-22 08:48:46 -04:00
Michael Grosser
950bf54cda
Using write with unless_exist + expires_in should unlock after the given expires_in and not 5 minutes later (#40260)
Co-authored-by: Jye Lee <jyelee124@gmail.com>
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
2020-09-20 21:07:35 +01:00
Ryuta Kamizono
c848baffd2 ✂️ [ci skip]
895134bcff (diff-7789e18ec0a61c6845755a257e6eb34fR3)
ee9e308f68 (diff-5e9551294914b338d923032fa904c6beR103)
5f63c771f7 (diff-600d5368b55e46ed961abb4295977ac3R506)
48b6bacbc5 (diff-279ac5c088a3ee7e9f954bbc10d1b773R246)
49adb7f4c6 (diff-0cbe7171fdd7821fd5836896849141c0R111)
9bfe89e68e (diff-9c1c95b001e3680ba8a473cf23508b68R8)
a0f18e6090 (diff-bef0ae2c16dacf77bfd2ba099af8a330R47)
8b4d344815 (diff-09660f59aee7ec893ad609315e8843c5R18)
49d1b5a98d (diff-531e71a9d5fdc8181f38ce4416553694R107)
b674f04756 (diff-7521c0bb452244663b689e77658e63e3R98)
a9012af688 (diff-60bdcf1e1954ec56d41fc4c7bd8d3e39R512)
6380aee182 (diff-5158c234d5e19bb1cffadcbc088400f1R262)
c7820d8124 (diff-f4614e7ba8081c0c9e20fe64b6374228R60)
8df7ed3b88 (diff-0495ed68f82d1bbde593ab5491eab24aR169)
6f94260ac6 (diff-7ecb6672f3fd37dfb79c4539395d3857R28)
03e44f9300 (diff-e9234c4c6668852448059c0a35840bcaR185)
2020-09-16 09:52:10 +09:00
Jonathan Hefner
5611f4b430 Anchor BacktraceCleaner gem filter regexp
This ensures the default gem filter does not affect backtrace lines that
have a subpath incidentally matching a gem path.

Fixes #40196.
2020-09-07 16:44:57 -05:00
Rafael França
61716e1fde
Merge pull request #39350 from jaynetics/fix_rounding_of_custom_formatted_negative_amounts
Fix rounding of custom-formatted negative amounts
2020-08-26 16:08:55 -04:00
Rafael França
7bd416363a
Merge pull request #38699 from jasonyork/master
Add ActiveSupport::Duration conversion methods
2020-08-26 13:49:21 -04:00
Akshay Birajdar
a12a2707ac Implement #inspect for ActiveSupport::OrderedOptions 2020-08-26 21:50:09 +05:30
Jason York
a2535d9fe9 Rename prefix to in_* and update CHANGELOG 2020-08-26 09:36:03 -05:00
Jason York
7bd9603778 Add ActiveSupport::Duration conversion methods 2020-08-26 09:35:09 -05:00