Skip to content

Commit

Permalink
fix: add crystal 1.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jul 16, 2024
1 parent f7f4c44 commit 33a643b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: placeos-pulse
version: 1.0.2
version: 1.0.3
crystal: ">= 1.1.1"
license: MIT
authors:
Expand Down
6 changes: 3 additions & 3 deletions src/placeos-pulse/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module PlaceOS::Pulse

protected def heartbeat
message = Heartbeat.from_database
put("/instances/#{instance_id}/heartbeat", HeartbeatRequest.new(
put("/instances/#{instance_id}/heartbeat", PlaceOS::Pulse::HeartbeatRequest.new(
instance_id, saas?, message, @private_key
))
end
Expand All @@ -84,7 +84,7 @@ module PlaceOS::Pulse
public_key: @private_key.verify_key.to_slice.hexstring
)

post("/register", RegisterRequest.new(instance_id, saas?, register_message, @private_key))
post("/register", PlaceOS::Pulse::RegisterRequest.new(instance_id, saas?, register_message, @private_key))

if saas?
if token = instance_token
Expand All @@ -97,7 +97,7 @@ module PlaceOS::Pulse
base_interval: 10.milliseconds,
max_interval: 10.seconds,
) do
post("/instances/#{instance_id}/token", TokenRequest.new(
post("/instances/#{instance_id}/token", PlaceOS::Pulse::TokenRequest.new(
instance_id, saas?, token_message, @private_key
))
end
Expand Down
4 changes: 2 additions & 2 deletions src/placeos-pulse/message.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ module PlaceOS::Pulse
# Generate classes as using the generic Message(T) struct
{% begin %}
{% for request in Request.subclasses %}
struct {{ request.name }}Request < Message({{ request }})
struct {{ request.name }}Request < Message(::{{ request }})
end
{% end %}

{% for response in Response.subclasses %}
struct {{ request.name }}Response < Message({{ response }})
struct {{ request.name }}Response < Message(::{{ response }})
end
{% end %}
{% end %}
Expand Down
10 changes: 5 additions & 5 deletions src/placeos-pulse/request/heartbeat.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ module PlaceOS::Pulse
getter module_instances : Hash(String, ModuleCount)

def self.system_count
PlaceOS::Model::ControlSystem.count
::PlaceOS::Model::ControlSystem.count
end

def self.zone_count
PlaceOS::Model::Zone.count
::PlaceOS::Model::Zone.count
end

def self.feature_count
PlaceOS::Model::Metadata.all.each_with_object(Hash(Feature, Int32).new(0)) do |metadata, count|
::PlaceOS::Model::Metadata.all.each_with_object(Hash(Feature, Int32).new(0)) do |metadata, count|
# ignore historic versions of the metadata
next if metadata.is_version?
# Select for Zone metadata
next unless metadata.parent_id.try(&.starts_with? PlaceOS::Model::Zone.table_name)
next unless metadata.parent_id.try(&.starts_with? ::PlaceOS::Model::Zone.table_name)
# Select for valid feature name
next unless feature = Feature.parse? metadata.name

Expand All @@ -69,7 +69,7 @@ module PlaceOS::Pulse
end

def self.module_instances
PlaceOS::Model::Module
::PlaceOS::Model::Module
.all
.each_with_object(Hash(String, Tuple(Int32, Int32)).new { |h, k| h[k] = {0, 0} }) do |mod, tally|
count, running = tally[mod.name]
Expand Down

0 comments on commit 33a643b

Please sign in to comment.