26 lines
513 B
Crystal
26 lines
513 B
Crystal
module Backend
|
|
extend self
|
|
|
|
def run : Nil
|
|
{% if flag?(:development) %}
|
|
Log.warn { "Backend is running in development mode! Do not use this in production!" }
|
|
{% end %}
|
|
Log.info { "Starting services..." }
|
|
|
|
channel = Channel(Nil).new(SERVICES.size)
|
|
|
|
SERVICES.each do |service|
|
|
spawn do
|
|
service.call
|
|
channel.send(nil)
|
|
end
|
|
end
|
|
|
|
SERVICES.size.times do
|
|
channel.receive
|
|
end
|
|
Fiber.yield
|
|
Log.info { "Backend services started." }
|
|
end
|
|
end
|