safe_request_timeout 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +2 -1
- data/VERSION +1 -1
- data/lib/safe_request_timeout/active_record_hook.rb +2 -1
- data/lib/safe_request_timeout/railtie.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fb790302089e758479b7c2ec238ba5ad66d5f2cd01388c4be8679b3c15c7057
|
4
|
+
data.tar.gz: 9358570335e15cfe58340edb0c7b9ec9d3cf436b698fe34dd5164c8532101c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431be87c04f338cca58f4376cbcc71a7dbe2dbafd09457d9cc427cb96a8130bbd01b5e19bc45bbb895927119b55e50ff4ba023d1e6e009a25b481866fad55091
|
7
|
+
data.tar.gz: 010ebff4d68d374cd403a5480a856a20d84b9fb5b73d931ec32f4821e1c7cd298c08bf0fdd4d8840c1b4297df0e75ffa6bac7be27764c4b209284635002eeb07
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 1.0.2
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Added support for ActiveRecord 7.1.
|
11
|
+
|
12
|
+
## 1.0.1
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Handle case in Railtie where database connection not available.
|
16
|
+
|
7
17
|
## 1.0.0
|
8
18
|
|
9
19
|
### Added
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
# Request Timeout
|
1
|
+
# Safe Request Timeout
|
2
2
|
|
3
3
|
[![Continuous Integration](https://github.com/bdurand/safe_request_timeout/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/safe_request_timeout/actions/workflows/continuous_integration.yml)
|
4
|
+
[![Regression Test](https://github.com/bdurand/safe_request_timeout/actions/workflows/regression_test.yml/badge.svg)](https://github.com/bdurand/safe_request_timeout/actions/workflows/regression_test.yml)
|
4
5
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
5
6
|
|
6
7
|
This gem provides a safe and convenient mechanism for adding a timeout mechanism to a block of code. The gem ensures that the timeout is safe to call and will not raise timeout errors from random places in your code which can leave your application in an indeterminate state.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
@@ -9,8 +9,9 @@ module SafeRequestTimeout
|
|
9
9
|
# @return [void]
|
10
10
|
def add_timeout!(connection_class = nil)
|
11
11
|
connection_class ||= ::ActiveRecord::Base.connection.class
|
12
|
+
exec_method = (connection_class.instance_methods.include?(:internal_exec_query) ? :internal_exec_query : :exec_query)
|
12
13
|
|
13
|
-
SafeRequestTimeout::Hooks.add_timeout!(connection_class, [
|
14
|
+
SafeRequestTimeout::Hooks.add_timeout!(connection_class, [exec_method])
|
14
15
|
|
15
16
|
SafeRequestTimeout::Hooks.clear_timeout!(connection_class, [:commit_db_transaction])
|
16
17
|
end
|
@@ -9,7 +9,11 @@ module SafeRequestTimeout
|
|
9
9
|
initializer "safe_request_timeout" do |app|
|
10
10
|
if app.config.safe_request_timeout.active_record_hook
|
11
11
|
ActiveSupport.on_load(:active_record) do
|
12
|
-
|
12
|
+
begin
|
13
|
+
SafeRequestTimeout::ActiveRecordHook.add_timeout!
|
14
|
+
rescue ActiveRecord::ActiveRecordError => e
|
15
|
+
Rails.logger&.warn("Could not add ActiveRecord hook for SafeRequestTimeout: #{e.inspect}")
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_request_timeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|