Skip to content

Commit

Permalink
chore: fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Oct 24, 2024
1 parent 47ab416 commit 1455378
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/repositories_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/systems_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/users_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helpers/spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions spec/webrtc/signaller_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/placeos-rest-api/controllers/edges/connection_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/placeos-rest-api/controllers/repositories.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/placeos-rest-api/controllers/webrtc/chat_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/placeos-rest-api/controllers/webrtc/clustered_sessions.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/placeos-rest-api/websocket/manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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|
Expand Down
6 changes: 3 additions & 3 deletions src/placeos-rest-api/websocket/session.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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" }
Expand Down

0 comments on commit 1455378

Please sign in to comment.