rails_pulse 0.3.3.pre.2 → 0.3.3.pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/rails_pulse/job.rb +2 -0
- data/app/models/rails_pulse/route.rb +15 -1
- data/lib/rails_pulse/tracker.rb +1 -2
- data/lib/rails_pulse/version.rb +1 -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: 80612b2461699451e01b4efa5ef5143eeb6c24d042eaba019e82d1aed02145d2
|
|
4
|
+
data.tar.gz: 119e0dd5913f3f6930bd1fe64c4234d9196c58f2388d818a26db7c85519f350d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60f5e66f20e1cf0cdbeee2a1f543509a227121c758248236adc8bc1d49690f968b64335842dba4192ed0c4b960fb9cdb783b003946e60278731282d520975b5b
|
|
7
|
+
data.tar.gz: 9a25108617038b5ac69646fceee12a14fb9f18fc278a83f104a020ee245c74e7450111d31feb37d2357fd621e010c021ee1f77fbd74c735c24ef5ac60981faa6
|
|
@@ -13,7 +13,21 @@ module RailsPulse
|
|
|
13
13
|
validates :path, presence: true
|
|
14
14
|
|
|
15
15
|
def self.by_method_and_path(method, path)
|
|
16
|
-
|
|
16
|
+
# Fast path: route already exists (the common case for recurring requests).
|
|
17
|
+
route = find_by(method: method, path: path)
|
|
18
|
+
return route if route
|
|
19
|
+
|
|
20
|
+
# Use INSERT ... ON CONFLICT DO NOTHING rather than create_or_find_by so that
|
|
21
|
+
# concurrent inserts for the same route are silently skipped at the database level.
|
|
22
|
+
# create_or_find_by rescues RecordNotUnique at the Ruby level, but PostgreSQL still
|
|
23
|
+
# logs a constraint violation ERROR before raising — causing noisy logs.
|
|
24
|
+
# unique_by is omitted for cross-database compatibility (MySQL rejects it); there is
|
|
25
|
+
# only one unique constraint on this table so DO NOTHING resolves unambiguously.
|
|
26
|
+
# Tags must be set explicitly here because insert bypasses before_save callbacks.
|
|
27
|
+
insert(
|
|
28
|
+
{ method: method, path: path, tags: "[]", created_at: Time.current, updated_at: Time.current }
|
|
29
|
+
)
|
|
30
|
+
find_by!(method: method, path: path)
|
|
17
31
|
end
|
|
18
32
|
|
|
19
33
|
def self.ransackable_attributes(auth_object = nil)
|
data/lib/rails_pulse/tracker.rb
CHANGED
|
@@ -26,8 +26,7 @@ module RailsPulse
|
|
|
26
26
|
RailsPulse::ApplicationRecord.connection_pool.with_connection do
|
|
27
27
|
RequestStore.store[:skip_recording_rails_pulse_activity] = true
|
|
28
28
|
|
|
29
|
-
route = RailsPulse::Route.
|
|
30
|
-
RailsPulse::Route.create_or_find_by(method: data[:method], path: data[:path])
|
|
29
|
+
route = RailsPulse::Route.by_method_and_path(data[:method], data[:path])
|
|
31
30
|
|
|
32
31
|
request = RailsPulse::Request.create!(
|
|
33
32
|
route: route,
|
data/lib/rails_pulse/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_pulse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.3.pre.
|
|
4
|
+
version: 0.3.3.pre.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Harvey
|
|
@@ -520,7 +520,7 @@ metadata:
|
|
|
520
520
|
changelog_uri: https://github.com/railspulse/rails_pulse/blob/main/CHANGELOG.md
|
|
521
521
|
documentation_uri: https://railspulse.com/documentation/installation
|
|
522
522
|
post_install_message: |
|
|
523
|
-
Rails Pulse 0.3.3.pre.
|
|
523
|
+
Rails Pulse 0.3.3.pre.3 installed. If upgrading, run:
|
|
524
524
|
rails generate rails_pulse:upgrade && rails db:migrate
|
|
525
525
|
rdoc_options: []
|
|
526
526
|
require_paths:
|