Skip to content

Commit

Permalink
added refresh_delay to config
Browse files Browse the repository at this point in the history
  • Loading branch information
RestartFU committed Nov 13, 2024
1 parent 2d8969a commit 932a82c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ require "yaml"
class Config
include YAML::Serializable

getter default : String = %(seperator: "|"
getter default : String = %(refresh_delay: 1
seperator: "|"
commands: [
"Restart",
"$(date +%a) $(date +%b) $(date +%d)",
"Restart",
"$(date +%a) $(date +%b) $(date +%d)",
"$(date +%r)",
]
)
@[YAML::Field(key: "refresh_delay")]
property refresh_delay : Int64 = 1

@[YAML::Field(key: "seperator")]
property seperator : String = "|"
Expand All @@ -35,4 +38,4 @@ commands: [
@seperator = config.seperator
@commands = config.commands
end
end
end
6 changes: 3 additions & 3 deletions src/xstatus.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class XStatus
exit 0
end

def trap_signals(signals : Array)
def trap_signals(signals : Array)
signals.each do |s|
s.trap do
terminate 0
Expand All @@ -44,7 +44,7 @@ class XStatus
rescue ex
Logger.fatalln ex
end
sleep 1.second
sleep conf.refresh_delay.millisecond
end
end

Expand All @@ -56,4 +56,4 @@ class XStatus
end

p = XStatus.new
p.run
p.run

0 comments on commit 932a82c

Please sign in to comment.