Skip to content

Commit 53eb578

Browse files
committed
Rename start_time to server_start_time for clarity and update related references
1 parent 00c9d82 commit 53eb578

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/hooks/app/api.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class API
2121
include Hooks::App::Auth
2222

2323
class << self
24-
attr_reader :start_time
24+
attr_reader :server_start_time
2525
end
2626

2727
# Create a new configured API class
2828
def self.create(config:, endpoints:, log:)
29-
@start_time = Time.now
29+
@server_start_time = Time.now
3030

3131
Hooks::Log.instance = log
3232

lib/hooks/app/endpoints/health.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class HealthEndpoint < Grape::API
1212
status: "healthy",
1313
timestamp: Time.now.iso8601,
1414
version: Hooks::VERSION,
15-
uptime_seconds: (Time.now - Hooks::App::API.start_time).to_i
15+
uptime_seconds: (Time.now - Hooks::App::API.server_start_time).to_i
1616
}.to_json
1717
end
1818
end

spec/unit/lib/hooks/app/endpoints/health_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def app
1010
end
1111

1212
before do
13-
# Mock API start_time for consistent uptime calculation
14-
allow(Hooks::App::API).to receive(:start_time).and_return(Time.parse("2024-12-31T23:59:00Z"))
13+
# Mock API server_start_time for consistent uptime calculation
14+
allow(Hooks::App::API).to receive(:server_start_time).and_return(Time.parse("2024-12-31T23:59:00Z"))
1515
end
1616

1717
describe "GET /" do
@@ -66,7 +66,7 @@ def app
6666
it "calculates uptime correctly" do
6767
# Test with different start time
6868
different_start = Time.parse("2024-12-31T23:58:30Z")
69-
allow(Hooks::App::API).to receive(:start_time).and_return(different_start)
69+
allow(Hooks::App::API).to receive(:server_start_time).and_return(different_start)
7070

7171
get "/"
7272

0 commit comments

Comments
 (0)