fast_ci 1.1.1 → 1.2.1
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/Gemfile.lock +1 -1
- data/lib/fast_ci/version.rb +1 -1
- data/lib/fast_ci.rb +27 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b81a68573c2f4000217c3783c48815e591f3b143ca185d6e379a0f7d27e1ac6e
|
4
|
+
data.tar.gz: e5d8b616c8739f83f48dd47e20db300a434161c9bea4a71ce9411802f537ef8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe3f867a2d7b7045ed9948d2779c5c7940414f5f2c724f992c97bcd368c31f8ead8f6c4e9da5d34fcbd274268aaeb6778aa582853c3ee386e9db54f8a62a745e
|
7
|
+
data.tar.gz: d8786cabc21ceddbee5826ce36dd874f0bcbbe4ff3f075b095a1bf3db693cc1d414d840474916822843ec59ab6b3c2c53ccd43f9a4d07564cd437addef899ae2
|
data/Gemfile.lock
CHANGED
data/lib/fast_ci/version.rb
CHANGED
data/lib/fast_ci.rb
CHANGED
@@ -113,7 +113,7 @@ module FastCI
|
|
113
113
|
|
114
114
|
def initialize(run_key)
|
115
115
|
@on = {}
|
116
|
-
@ref =
|
116
|
+
@ref = 1
|
117
117
|
@run_key = run_key
|
118
118
|
end
|
119
119
|
|
@@ -124,20 +124,24 @@ module FastCI
|
|
124
124
|
@on[event] = block
|
125
125
|
end
|
126
126
|
|
127
|
-
def send_msg(event, payload = {})
|
127
|
+
def send_msg(event, payload = {}, custom_topic = nil, custom_ref = nil)
|
128
128
|
FastCI.debug("ws#send_msg: #{event} -> #{payload.inspect}")
|
129
|
-
connection.write({ "topic": topic, "event": event, "payload": payload, "ref": ref })
|
129
|
+
connection.write({ "topic": custom_topic || topic, "event": event, "payload": payload, "ref": custom_ref || ref })
|
130
130
|
connection.flush
|
131
131
|
end
|
132
132
|
|
133
|
+
def get_connection
|
134
|
+
connection
|
135
|
+
end
|
136
|
+
|
133
137
|
def connect_to_ws
|
134
138
|
Async do |task|
|
135
139
|
before_start_connection
|
136
140
|
|
137
141
|
begin
|
138
142
|
Async::WebSocket::Client.connect(endpoint) do |connection|
|
139
|
-
after_start_connection
|
140
143
|
self.connection = connection
|
144
|
+
after_start_connection
|
141
145
|
self.task = task
|
142
146
|
yield
|
143
147
|
|
@@ -159,6 +163,21 @@ module FastCI
|
|
159
163
|
end
|
160
164
|
end
|
161
165
|
|
166
|
+
def start_heartbeat
|
167
|
+
Async do
|
168
|
+
loop do
|
169
|
+
sleep 30
|
170
|
+
break if connection.closed?
|
171
|
+
send_heartbeat
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def send_heartbeat
|
177
|
+
FastCI.debug("Sending heartbeat")
|
178
|
+
send_msg("heartbeat", {}, "phoenix", 0)
|
179
|
+
end
|
180
|
+
|
162
181
|
def await(retry_count = 0)
|
163
182
|
connect_to_ws do
|
164
183
|
send_msg("phx_join")
|
@@ -168,6 +187,9 @@ module FastCI
|
|
168
187
|
FastCI.debug("ws#msg_received: #{message.inspect}")
|
169
188
|
|
170
189
|
response = message.dig(:payload, :response)
|
190
|
+
|
191
|
+
# Heartbeat
|
192
|
+
next if message.dig(:ref) == 0
|
171
193
|
|
172
194
|
case response&.dig(:event) || message[:event]
|
173
195
|
when "phx_error"
|
@@ -216,6 +238,7 @@ module FastCI
|
|
216
238
|
|
217
239
|
# https://github.com/bblimke/webmock/blob/b709ba22a2949dc3bfac662f3f4da88a21679c2e/lib/webmock/http_lib_adapters/async_http_client_adapter.rb#L8
|
218
240
|
def after_start_connection
|
241
|
+
start_heartbeat
|
219
242
|
if defined?(WebMock::HttpLibAdapters::AsyncHttpClientAdapter)
|
220
243
|
WebMock::HttpLibAdapters::AsyncHttpClientAdapter.enable!
|
221
244
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nesha Zoric
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: console
|
@@ -174,7 +174,7 @@ metadata:
|
|
174
174
|
homepage_uri: https://github.com/RubyCI/fast_ci_gem
|
175
175
|
source_code_uri: https://github.com/RubyCI/fast_ci_gem
|
176
176
|
changelog_uri: https://github.com/RubyCI/fast_ci_gem
|
177
|
-
post_install_message:
|
177
|
+
post_install_message:
|
178
178
|
rdoc_options: []
|
179
179
|
require_paths:
|
180
180
|
- lib
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
192
|
rubygems_version: 3.2.3
|
193
|
-
signing_key:
|
193
|
+
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Ruby wrapper for creating FastCI integrations
|
196
196
|
test_files: []
|