diff --git a/shard.lock b/shard.lock index 16cb7535..d840b72e 100644 --- a/shard.lock +++ b/shard.lock @@ -179,7 +179,7 @@ shards: openai: git: https://github.com/spider-gazelle/crystal-openai.git - version: 0.9.1+git.commit.bf862d19e3c9a84cd6dd01bbec6b06931697a6d3 + version: 0.9.2+git.commit.df5b615fb3514117c7c4530624aff0f8f7c15477 openssl_ext: git: https://github.com/spider-gazelle/openssl_ext.git @@ -243,7 +243,7 @@ shards: placeos-frontend-loader: git: https://github.com/placeos/frontend-loader.git - version: 2.7.1+git.commit.0222bb2d930170e2fdc2b78165851026b6edfb5e + version: 2.7.1+git.commit.f1a29dbc4a249c88a7f9e6e4d91fd5c297a16677 placeos-log-backend: git: https://github.com/place-labs/log-backend.git @@ -255,7 +255,7 @@ shards: placeos-resource: git: https://github.com/place-labs/resource.git - version: 3.1.0 + version: 3.1.1 pool: git: https://github.com/ysbaddaden/pool.git @@ -307,7 +307,7 @@ shards: search-ingest: git: https://github.com/placeos/search-ingest.git - version: 2.11.2+git.commit.877632eaa87e4967ba1758a5e9dd000e1e0f951f + version: 2.11.2+git.commit.9d65ed4afd399b9f5659330bf001c1df82258d42 secrets-env: # Overridden git: https://github.com/spider-gazelle/secrets-env.git diff --git a/spec/controllers/repositories_spec.cr b/spec/controllers/repositories_spec.cr index 9b2d7b81..ee578d9d 100644 --- a/spec/controllers/repositories_spec.cr +++ b/spec/controllers/repositories_spec.cr @@ -95,13 +95,13 @@ module PlaceOS::Api result = PlaceOS::Api::Repositories.pull_repository(repo, 10.seconds) end - sleep 1 + sleep 1.second repo.reload! repo.deployed_commit_hash.should be_nil repo.deployed_commit_hash = "123456" repo.save! - sleep 1 + sleep 1.second result.should_not be_nil if output = result output[1].should eq "123456" diff --git a/spec/controllers/systems_spec.cr b/spec/controllers/systems_spec.cr index 1848415c..3b96296f 100644 --- a/spec/controllers/systems_spec.cr +++ b/spec/controllers/systems_spec.cr @@ -186,7 +186,7 @@ module PlaceOS::Api sys.modules = [module_id] end systems.each &.save! - sleep 1 + sleep 1.second expected_ids = expected_systems.compact_map(&.id) total_ids = expected_ids.size diff --git a/spec/controllers/users_spec.cr b/spec/controllers/users_spec.cr index 2be184d0..1f018e97 100644 --- a/spec/controllers/users_spec.cr +++ b/spec/controllers/users_spec.cr @@ -13,7 +13,7 @@ module PlaceOS::Api params = HTTP::Params.encode({"q" => model.email.to_s, "fields" => "email,"}) path = "#{Users.base_route}?#{params}" - sleep 2 + sleep 2.seconds result = client.get( path: path, diff --git a/spec/spec_helpers/spec.cr b/spec/spec_helpers/spec.cr index cc92c167..497303aa 100644 --- a/spec/spec_helpers/spec.cr +++ b/spec/spec_helpers/spec.cr @@ -22,7 +22,7 @@ module PlaceOS::Api::Spec name = random_name doc.name = name doc.save! - sleep 1 + sleep 1.second refresh_elastic({{ klass }}.table_name) diff --git a/spec/webrtc/signaller_spec.cr b/spec/webrtc/signaller_spec.cr index 2194f1a8..2f041339 100644 --- a/spec/webrtc/signaller_spec.cr +++ b/spec/webrtc/signaller_spec.cr @@ -23,7 +23,7 @@ module PlaceOS::Api to_user: "server", value: nil ).to_json) - sleep 0.5 + sleep 500.milliseconds updates.size.should eq 2 sessions = CallDetails::SESSIONS @@ -37,7 +37,7 @@ module PlaceOS::Api body: transfer, headers: Spec::Authentication.headers, ) - sleep 0.5 + sleep 500.milliseconds updates.size.should eq 3 updates[-1].value.should eq transfer @@ -48,7 +48,7 @@ module PlaceOS::Api body: {reason: "bad user"}.to_json, headers: Spec::Authentication.headers, ) - sleep 0.5 + sleep 500.milliseconds updates.size.should eq 4 ws.closed?.should be_true end diff --git a/src/app.cr b/src/app.cr index cad31bc5..9a724342 100644 --- a/src/app.cr +++ b/src/app.cr @@ -92,7 +92,7 @@ server.cluster(process_count, "-w", "--workers") if cluster terminate = Proc(Signal, Nil).new do |signal| puts " > terminating gracefully" - spawn(same_thread: true) { server.close } + spawn { server.close } signal.ignore end diff --git a/src/placeos-rest-api/controllers/edges/connection_manager.cr b/src/placeos-rest-api/controllers/edges/connection_manager.cr index affc0664..fc8cee56 100644 --- a/src/placeos-rest-api/controllers/edges/connection_manager.cr +++ b/src/placeos-rest-api/controllers/edges/connection_manager.cr @@ -28,7 +28,7 @@ module PlaceOS::Api current_nodes = core_discovery.nodes loop do begin - sleep 6 + sleep 6.seconds new_nodes = core_discovery.nodes if current_nodes != new_nodes current_nodes = new_nodes @@ -40,7 +40,7 @@ module PlaceOS::Api end rescue error Log.warn(exception: error) { "error starting rebalance detection loop" } - sleep 1 + sleep 1.seconds spawn { detect_rebalance } end @@ -174,7 +174,7 @@ module PlaceOS::Api Log.debug { {edge_id: edge_id, message: "successfully added edge to core connection"} } - spawn(same_thread: true) do + spawn do begin socket.run rescue e diff --git a/src/placeos-rest-api/controllers/repositories.cr b/src/placeos-rest-api/controllers/repositories.cr index 616415e1..4e9142e6 100644 --- a/src/placeos-rest-api/controllers/repositories.cr +++ b/src/placeos-rest-api/controllers/repositories.cr @@ -92,7 +92,7 @@ module PlaceOS::Api def self.pull_repository(repository : ::PlaceOS::Model::Repository, timeout = 1.minute) # Trigger a pull event spawn do - sleep 0.1 + sleep 100.milliseconds repository.pull! end diff --git a/src/placeos-rest-api/controllers/webrtc/chat_manager.cr b/src/placeos-rest-api/controllers/webrtc/chat_manager.cr index 2c6d3dc2..6e51a705 100644 --- a/src/placeos-rest-api/controllers/webrtc/chat_manager.cr +++ b/src/placeos-rest-api/controllers/webrtc/chat_manager.cr @@ -31,7 +31,7 @@ module PlaceOS::Api protected def ping_sockets loop do - sleep 30 + sleep 30.seconds # ping the sockets to ensure connectivity begin @@ -245,7 +245,7 @@ module PlaceOS::Api # find the users websocket spawn do - sleep 1 + sleep 1.second redis_publish("placeos/internal/chat/kick_user", {user_id, "call ended"}) end end diff --git a/src/placeos-rest-api/controllers/webrtc/clustered_sessions.cr b/src/placeos-rest-api/controllers/webrtc/clustered_sessions.cr index 911b4418..81a84685 100644 --- a/src/placeos-rest-api/controllers/webrtc/clustered_sessions.cr +++ b/src/placeos-rest-api/controllers/webrtc/clustered_sessions.cr @@ -6,7 +6,7 @@ require "placeos-driver/proxy/remote_driver" class PlaceOS::Api::ClusteredSessions def initialize sleep_time = 60 + rand(50) - spawn { touch_sessions(sleep_time) } + spawn { touch_sessions(sleep_time.seconds) } end # we track local sessions and keep those keys alive in redis @@ -73,7 +73,7 @@ class PlaceOS::Api::ClusteredSessions end end - def touch_sessions(sleep_time : Int32) + def touch_sessions(sleep_time : Time::Span) loop do begin sleep sleep_time diff --git a/src/placeos-rest-api/websocket/manager.cr b/src/placeos-rest-api/websocket/manager.cr index bbdae6e1..1820bf0a 100644 --- a/src/placeos-rest-api/websocket/manager.cr +++ b/src/placeos-rest-api/websocket/manager.cr @@ -17,10 +17,10 @@ module PlaceOS::Api::WebSocket @session_cleaner : Tasker::Task? def initialize(@discovery : Clustering::Discovery) - spawn(name: "cleanup_sessions", same_thread: true) do + spawn(name: "cleanup_sessions") do cleanup_sessions end - spawn(name: "ping_sockets", same_thread: true) do + spawn(name: "ping_sockets") do ping_sockets end end @@ -56,7 +56,7 @@ module PlaceOS::Api::WebSocket protected def ping_sockets loop do - sleep 80 + sleep 80.seconds begin connections = session_lock.synchronize { sessions.dup } connections.each do |session| diff --git a/src/placeos-rest-api/websocket/session.cr b/src/placeos-rest-api/websocket/session.cr index 766de316..c03a9076 100644 --- a/src/placeos-rest-api/websocket/session.cr +++ b/src/placeos-rest-api/websocket/session.cr @@ -41,7 +41,7 @@ module PlaceOS::Api::WebSocket # Register event handlers ws.on_message do |message| Log.trace { {frame: "TEXT", text: message} } - spawn(same_thread: true) do + spawn do on_message(message) end end @@ -63,7 +63,7 @@ module PlaceOS::Api::WebSocket @cache_cleaner = Tasker.instance.every(cache_timeout) { clear_caches } # Perform writes - spawn(name: "socket_writes_#{request_id}", same_thread: true) { run_writes } + spawn(name: "socket_writes_#{request_id}") { run_writes } end # WebSocket API Handlers @@ -240,7 +240,7 @@ module PlaceOS::Api::WebSocket end end - spawn(same_thread: true) { ws.run } + spawn { ws.run } debug_sessions[{system_id, module_name, index}] = ws else Log.trace { "reusing existing debug socket" }