Skip to content

Commit

Permalink
Merge pull request #163 from topfreegames/feature/add-is-running-method
Browse files Browse the repository at this point in the history
Add `IsRunning` function to the `pitaya.Pitaya`
  • Loading branch information
gabrielcorado committed Jan 18, 2021
2 parents e2e622c + e246d27 commit e32739b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Tests
on:
push:
branches:
- master
- v2
pull_request:
branches:
- master
- v2

jobs:
deps:
Expand Down
8 changes: 8 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type Pitaya interface {
StartWorker()
RegisterRPCJob(rpcJob worker.RPCJob) error
Documentation(getPtrNames bool) (map[string]interface{}, error)
IsRunning() bool

RPC(ctx context.Context, routeStr string, reply proto.Message, arg proto.Message) error
RPCTo(ctx context.Context, serverID, routeStr string, reply proto.Message, arg proto.Message) error
Expand Down Expand Up @@ -252,6 +253,13 @@ func (app *App) GetServers() []*cluster.Server {
return app.serviceDiscovery.GetServers()
}

// IsRunning indicates if the Pitaya app has been initialized. Note: This
// doesn't cover acceptors, only the pitaya internal registration and modules
// initialization.
func (app *App) IsRunning() bool {
return app.running
}

// SetLogger logger setter
func SetLogger(l logging.Logger) {
logger.Log = l
Expand Down
14 changes: 14 additions & 0 deletions mocks/app.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e32739b

Please sign in to comment.