svelte-on-rails 22.4.2 → 22.4.4
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/lib/svelte_on_rails/lib/utils.rb +2 -1
- data/lib/svelte_on_rails/ssr_client.rb +11 -5
- data/lib/tasks/svelte_on_rails_tasks.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cb9864da582328d603e647cacb755402d42a08241ac60adaf73519d8627f10d
|
|
4
|
+
data.tar.gz: b223d557c6a5eb030710926a55b5f9ee5446c2641748b6aca30f9d76f2ebaf5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95bea92ab87a3c73cbe9cc51637dbc3506110c5af1074fde97b3a794314fdae3b39b76748d973a7d4587294dde211027bdf1ef8955be528424f9818110431c3f
|
|
7
|
+
data.tar.gz: 6d21e528178d757eb73184d7f2b00a51123581645503fd5c6636f9e2297d3a3cc8a7364f656d062d36f73387ff045c51d1cabae9adb0154e6a39d30c30a5b0e7
|
|
@@ -171,11 +171,12 @@ module SvelteOnRails
|
|
|
171
171
|
Rails.root.join("log", "svelte-ssr-server.log")
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
-
def self.ssr_server_log(msg)
|
|
174
|
+
def self.ssr_server_log(msg, ssr_logfile_only: false)
|
|
175
175
|
File.open(ssr_server_logfile, 'a') do |f|
|
|
176
176
|
f.sync = true
|
|
177
177
|
f.puts("[#{Time.now.utc.iso8601(3)} ppid:#{Process.ppid} pid:#{Process.pid}] #{msg}")
|
|
178
178
|
end
|
|
179
|
+
return if ssr_logfile_only
|
|
179
180
|
puts "[SOR] #{msg}"
|
|
180
181
|
$stdout.flush
|
|
181
182
|
end
|
|
@@ -167,11 +167,16 @@ module SvelteOnRails
|
|
|
167
167
|
restart_after_failure: false
|
|
168
168
|
)
|
|
169
169
|
|
|
170
|
-
SvelteOnRails::Lib::Utils.ssr_server_log("SOR start_node_server! called"
|
|
170
|
+
SvelteOnRails::Lib::Utils.ssr_server_log("SOR start_node_server! called", ssr_logfile_only: !restart_after_failure)
|
|
171
171
|
|
|
172
172
|
# notice ppid
|
|
173
|
-
FileUtils.mkdir_p(@helpers.
|
|
174
|
-
File.write(@helpers.
|
|
173
|
+
FileUtils.mkdir_p(@helpers.ssr_client_ppid_file.dirname)
|
|
174
|
+
File.write(@helpers.ssr_client_ppid_file, Process.ppid.to_s)
|
|
175
|
+
if @helpers.ssr_client_ppid_file.exist?
|
|
176
|
+
SvelteOnRails::Lib::Utils.ssr_server_log("File #{@helpers.ssr_client_ppid_file} written, PPID: #{Process.ppid}", ssr_logfile_only: true)
|
|
177
|
+
else
|
|
178
|
+
SvelteOnRails::Lib::Utils.ssr_server_log("ERROR: File #{@helpers.ssr_client_ppid_file} could not be written")
|
|
179
|
+
end
|
|
175
180
|
|
|
176
181
|
start = Time.now
|
|
177
182
|
|
|
@@ -343,7 +348,7 @@ module SvelteOnRails
|
|
|
343
348
|
|
|
344
349
|
end
|
|
345
350
|
|
|
346
|
-
def
|
|
351
|
+
def ssr_client_ppid_file
|
|
347
352
|
Rails.root.join("tmp", "pids", 'svelte_on_rails.ppid')
|
|
348
353
|
end
|
|
349
354
|
|
|
@@ -396,7 +401,7 @@ module SvelteOnRails
|
|
|
396
401
|
def shutdown(current_ppid: Process.ppid)
|
|
397
402
|
terminate_processes(own_processes(current_ppid: current_ppid), label: "own")
|
|
398
403
|
ensure
|
|
399
|
-
File.delete(
|
|
404
|
+
File.delete(ssr_client_ppid_file) if File.exist?(ssr_client_ppid_file)
|
|
400
405
|
end
|
|
401
406
|
|
|
402
407
|
private
|
|
@@ -408,6 +413,7 @@ module SvelteOnRails
|
|
|
408
413
|
|
|
409
414
|
processes.group_by(&:socket_path).values.flat_map { |g| g.sort_by(&:pid) }.each do |p|
|
|
410
415
|
Process.kill("SIGINT", p.pid) rescue Errno::ESRCH || Errno::EPERM
|
|
416
|
+
SvelteOnRails::Lib::Utils.ssr_server_log(" Killed #{label} unix-pid: #{p.pid}, rails-ppid: #{p.ppid}, socket-path: #{p.socket_path}", ssr_logfile_only: true)
|
|
411
417
|
end
|
|
412
418
|
|
|
413
419
|
SvelteOnRails::Lib::Utils.ssr_server_log("Killed #{processes.length} #{label} process#{'es' if processes.length != 1}")
|
|
@@ -16,7 +16,7 @@ namespace :svelte_on_rails do
|
|
|
16
16
|
|
|
17
17
|
unless File.socket?(socket_path)
|
|
18
18
|
puts "*" * 80
|
|
19
|
-
puts "ERROR:
|
|
19
|
+
puts "ERROR: socket file does not exist or is not a socket: #{socket_path}"
|
|
20
20
|
puts "Do you have set RAILS_ENV correctly?"
|
|
21
21
|
puts "*" * 80
|
|
22
22
|
end
|