@@ -3,7 +3,13 @@ package main
33import (
44 "context"
55 "fmt"
6+ "net/http"
7+ "os"
8+ "os/signal"
9+ "time"
10+
611 log "github.com/sirupsen/logrus"
12+
713 "github.com/qa-dev/jsonwire-grid/config"
814 "github.com/qa-dev/jsonwire-grid/handlers"
915 "github.com/qa-dev/jsonwire-grid/logger"
@@ -12,10 +18,6 @@ import (
1218 "github.com/qa-dev/jsonwire-grid/pool/capabilities"
1319 poolMetrics "github.com/qa-dev/jsonwire-grid/pool/metrics"
1420 "github.com/qa-dev/jsonwire-grid/utils/metrics"
15- "net/http"
16- "os"
17- "os/signal"
18- "time"
1921)
2022
2123func main () {
@@ -75,8 +77,6 @@ func main() {
7577 poolInstance .SetBusyNodeDuration (busyNodeDuration )
7678 poolInstance .SetReservedNodeDuration (reservedNodeDuration )
7779
78-
79-
8080 go func () {
8181 for {
8282 poolInstance .FixNodeStatuses ()
@@ -93,8 +93,6 @@ func main() {
9393 }
9494 }()
9595
96-
97-
9896 if cfg .Statsd != nil {
9997 statsdClient , err := metrics .NewStatsd (
10098 cfg .Statsd .Host ,
@@ -110,10 +108,11 @@ func main() {
110108 }
111109 middlewareWrap .Add (middleware .NewStatsd (log .StandardLogger (), statsdClient , true ).RegisterMetrics )
112110 }
113-
111+
114112 http .Handle ("/wd/hub/session" , middlewareWrap .Do (& handlers.CreateSession {Pool : poolInstance , ClientFactory : clientFactory })) //selenium
115113 http .Handle ("/session" , middlewareWrap .Do (& handlers.CreateSession {Pool : poolInstance , ClientFactory : clientFactory })) //wda
116114 http .Handle ("/grid/register" , middlewareWrap .Do (& handlers.RegisterNode {Pool : poolInstance }))
115+ http .Handle ("/grid/status" , middlewareWrap .Do (& handlers.GridStatus {Pool : poolInstance , Config : * cfg }))
117116 http .Handle ("/grid/api/proxy" , & handlers.APIProxy {Pool : poolInstance })
118117 http .HandleFunc ("/_info" , heartbeat )
119118 http .Handle ("/" , middlewareWrap .Do (& handlers.UseSession {Pool : poolInstance , Cache : cache }))
0 commit comments