Skip to content

Commit aebb492

Browse files
author
Adrian Salceanu
committed
Server isrunning check
1 parent 11670de commit aebb492

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Genie"
22
uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
33
authors = ["Adrian Salceanu <[email protected]>"]
4-
version = "4.1.0"
4+
version = "4.2.0"
55

66
[deps]
77
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"

src/AppServer.jl

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using HTTP, Sockets
77
import Millboard, Distributed, Logging, MbedTLS
88
import Genie
99

10+
1011
"""
1112
ServersCollection(webserver::Union{Task,Nothing}, websockets::Union{Task,Nothing})
1213
@@ -29,6 +30,9 @@ const Servers = SERVERS
2930
function isrunning(server::ServersCollection, prop::Symbol = :webserver) :: Bool
3031
isa(getfield(server, prop), Task) && ! istaskdone(getfield(server, prop))
3132
end
33+
function isrunning(prop::Symbol = :webserver) :: Bool
34+
isempty(SERVERS) ? false : isrunning(SERVERS[1], prop)
35+
end
3236

3337
function server_status(server::ServersCollection, prop::Symbol) :: Nothing
3438
if isrunning(server)

src/Genie.jl

+2-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ config.cache_storage == :File && include("cache_adapters/FileCache.jl")
5656

5757
include("Sessions.jl")
5858

59-
export serve, up, down, loadapp, genie, bootstrap
59+
export serve, up, down, loadapp, genie, bootstrap, isrunning
6060
@reexport using .Router
6161

6262
const assets_config = Genie.Assets.assets_config
@@ -220,9 +220,8 @@ Web Server starting at http://127.0.0.1:8000
220220
"""
221221
const startup = AppServer.startup
222222
const up = startup
223-
224-
225223
const down = AppServer.down
224+
const isrunning = AppServer.isrunning
226225

227226

228227
### PRIVATE ###

0 commit comments

Comments
 (0)