Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby/timeout
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.2
Choose a base ref
...
head repository: ruby/timeout
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.4.0
Choose a head ref
  • 7 commits
  • 9 files changed
  • 3 contributors

Commits on Mar 24, 2023

  1. Configuration menu
    Copy the full SHA
    1e31a9a View commit details
    Browse the repository at this point in the history
  2. Merge pull request #29 from ruby/update-test-lib-20230324

    Update test libraries from ruby/ruby 2023-03-24
    hsbt authored Mar 24, 2023
    Configuration menu
    Copy the full SHA
    b0ec156 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2023

  1. Configuration menu
    Copy the full SHA
    1c91ac2 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #31 from nobu/test-unit-ruby-core

    Use released version of test-unit-ruby-core
    nobu authored Jun 13, 2023
    Configuration menu
    Copy the full SHA
    20629a6 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2023

  1. Move gemspec files to top of lib directory.

      They have version.rb files with same directory.
      But version.rb have been removed at ruby/ruby#3375
      There is no reason to locate under the library name of directory.
    hsbt committed Jun 19, 2023
    Configuration menu
    Copy the full SHA
    cae26ed View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2023

  1. Raise exception instead of throw/catch for timeouts (#30)

    throw/catch is used for non-local control flow, not for exceptional situations.
    For exceptional situations, raise should be used instead.  A timeout is an
    exceptional situation, so it should use raise, not throw/catch.
    
    Timeout's implementation that uses throw/catch internally causes serious problems.
    Consider the following code:
    
    ```ruby
    def handle_exceptions
      yield
    rescue Exception => exc
      handle_error # e.g. ROLLBACK for databases
      raise
    ensure
      handle_exit unless exc # e.g. COMMIT for databases
    end
    
    Timeout.timeout(1) do
      handle_exceptions do
        do_something
      end
    end
    ```
    
    This kind of design ensures that all exceptions are handled as errors, and
    ensures that all exits (normal exit, early return, throw/catch) are not
    handled as errors.  With Timeout's throw/catch implementation, this type of
    code does not work, since a timeout triggers the normal exit path.
    
    See rails/rails#29333 for an example of the damage
    Timeout's design has caused the Rails ecosystem.
    
    This switches Timeout.timeout to use raise/rescue internally.  It adds a
    Timeout::ExitException subclass of exception for the internal raise/rescue,
    which Timeout.timeout will convert to Timeout::Error for backwards
    compatibility.  Timeout::Error remains a subclass of RuntimeError.
    
    This is how timeout used to work in Ruby 2.0.  It was changed in Ruby 2.1,
    after discussion in [Bug #8730] (commit
    238c003 in the timeout repository). I
    think the change from using raise/rescue to using throw/catch has caused
    significant harm to the Ruby ecosystem at large, and reverting it is
    the most sensible choice.
    
    From the translation of [Bug #8730], it appears the issue was that
    someone could rescue Exception and not reraise the exception, causing
    timeout errors to be swallowed.  However, such code is broken anyway.
    Using throw/catch causes far worse problems, because then it becomes
    impossible to differentiate between normal control flow and exceptional
    control flow.
    
    Also related to this is [Bug #11344], which changed how
    Thread.handle_interrupt interacted with Timeout.
    
    Co-authored-by: Nobuyoshi Nakada <[email protected]>
    jeremyevans and nobu authored Jun 22, 2023
    Configuration menu
    Copy the full SHA
    f16545a View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2023

  1. Bump up v0.4.0

    hsbt committed Jun 23, 2023
    Configuration menu
    Copy the full SHA
    413194f View commit details
    Browse the repository at this point in the history
Loading