1. 02 2月, 2019 9 次提交
  2. 01 2月, 2019 14 次提交
  3. 31 1月, 2019 15 次提交
    • A
      Remove the Kernel#` override that turns ENOENT into nil · 545b6e58
      Akinori MUSHA 提交于
      ActiveSupport overrides `` Kernel#` `` so that it would not raise
      `Errno::ENOENT` but return `nil` instead (due to the last statement
      `STDERR.puts` returning nil) if a given command were not found.
      Because of this, you cannot safely say somthing like
      `` `command`.chomp `` when ActiveSupport is loaded.
      
      It turns out that this is an outdated monkey patch for Windows
      platforms to emulate Unix behavior on an ancient version of Ruby, and
      it should be removed by now.
      545b6e58
    • A
      ActiveStorage typo fix. · a57f4def
      alkesh26 提交于
      a57f4def
    • A
      ActiveRecord typo fixe. · 37935457
      alkesh26 提交于
      37935457
    • Y
      Merge pull request #35109 from abhaynikam/35073-fix-automatic-database-switching-doc-typo · 23125378
      Yuji Yaginuma 提交于
      Fix typo: inherts -> inherits [ci skip]
      23125378
    • A
      15db608f
    • R
      Remove redundant begin block · 1f5e21bc
      Ryuta Kamizono 提交于
      We enabled `Style/RedundantBegin` cop at #34764, but it is hard to
      detect an offence if returning value put after the block.
      1f5e21bc
    • Y
      Fix `ERB.new` argument deprecated warning · 5754a29a
      yuuji.yaginuma 提交于
      This fixes following warning.
      
      ```
      warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
      ```
      5754a29a
    • E
      Merge pull request #35108 from jhawthorn/db-selection-timestamp-after · 0a9bb48f
      Eileen M. Uchitelle 提交于
      Write update_last_write_timestamp after request
      0a9bb48f
    • K
      Merge pull request #35104 from alkesh26/activemodel-typo-fixes · e01e6462
      Kasper Timm Hansen 提交于
      ActiveModel typo fixes.
      e01e6462
    • Y
      Merge pull request #34980 from y-yagi/fixes_34979 · 6729cef7
      Yuji Yaginuma 提交于
      Don't add `RAILS_ENV` in generate action
      6729cef7
    • J
      Write update_last_write_timestamp after request · ab952b19
      John Hawthorn 提交于
      We need to update using the timestamp from the end of the request, not
      the start. For example, if a request spends 5+ seconds writing, we still
      want to wait another 5 seconds for replication lag.
      
      Since we now run the update after we yield, we need to use ensure to
      make sure we update the timestamp even if there is an exception.
      ab952b19
    • A
      activemodel typo fixes. · 8b66ea5d
      alkesh26 提交于
      8b66ea5d
    • A
      Merge pull request #35093 from rails/av-base-constructor · 535a8b99
      Aaron Patterson 提交于
      Tighten up the AV::Base constructor
      535a8b99
    • E
      Merge pull request #35073 from eileencodes/db-selection · 8ca6bd2e
      Eileen M. Uchitelle 提交于
      Part 8: Multi db improvements, Adds basic automatic database switching to Rails
      8ca6bd2e
    • E
      Adds basic automatic database switching to Rails · 0abcec41
      Eileen Uchitelle 提交于
      The following PR adds behavior to Rails to allow an application to
      automatically switch it's connection from the primary to the replica.
      
      A request will be sent to the replica if:
      
      * The request is a read request (`GET` or `HEAD`)
      * AND It's been 2 seconds since the last write to the database (because
      we don't want to send a user to a replica if the write hasn't made it
      to the replica yet)
      
      A request will be sent to the primary if:
      
      * It's not a GET/HEAD request (ie is a POST, PATCH, etc)
      * Has been less than 2 seconds since the last write to the database
      
      The implementation that decides when to switch reads (the 2 seconds) is
      "safe" to use in production but not recommended without adequate testing
      with your infrastructure. At GitHub in addition to the a 5 second delay
      we have a curcuit breaker that checks the replication delay
      and will send the query to a replica before the 5 seconds has passed.
      This is specific to our application and therefore not something Rails
      should be doing for you. You'll need to test and implement more robust
      handling of when to switch based on your infrastructure. The auto
      switcher in Rails is meant to be a basic implementation / API that acts
      as a guide for how to implement autoswitching.
      
      The impementation here is meant to be strict enough that you know how to
      implement your own resolver and operations classes but flexible enough
      that we're not telling you how to do it.
      
      The middleware is not included automatically and can be installed in
      your application with the classes you want to use for the resolver and
      operations passed in. If you don't pass any classes into the middleware
      the Rails default Resolver and Session classes will be used.
      
      The Resolver decides what parameters define when to
      switch, Operations sets timestamps for the Resolver to read from. For
      example you may want to use cookies instead of a session so you'd
      implement a Resolver::Cookies class and pass that into the middleware
      via configuration options.
      
      ```
      config.active_record.database_selector = { delay: 2.seconds }
      config.active_record.database_resolver = MyResolver
      config.active_record.database_operations = MyResolver::MyCookies
      ```
      
      Your classes can inherit from the existing classes and reimplment the
      methods (or implement more methods) that you need to do the switching.
      You only need to implement methods that you want to change. For example
      if you wanted to set the session token for the last read from a replica
      you would reimplement the `read_from_replica` method in your resolver
      class and implement a method that updates a new timestamp in your
      operations class.
      0abcec41
  4. 30 1月, 2019 2 次提交