topfreegames / pitaya

Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.
MIT License
2.35k stars 482 forks source link

How to know when a server in the cluster is shutdown? #384

Closed alubahhh closed 2 months ago

alubahhh commented 9 months ago

When a server in the cluster is shut down, other servers can receive notifications and handle other operations.

bruce1125 commented 9 months ago

https://github.com/topfreegames/pitaya/blob/cc949c447b0c2dfacb07ff3a8e2c845facaa02b3/cluster/etcd_service_discovery.go#L701-L704

There isn't any public api can do it now, if you actually want, you could implement by yourself according the code above.

felipejfc commented 2 months ago

This can actually be implemented using the listeners which is a public API

https://github.com/topfreegames/pitaya/blob/cc949c447b0c2dfacb07ff3a8e2c845facaa02b3/cluster/etcd_service_discovery.go#L230-L247

bruce1125 commented 2 months ago

This can actually be implemented using the listeners which is a public API

https://github.com/topfreegames/pitaya/blob/cc949c447b0c2dfacb07ff3a8e2c845facaa02b3/cluster/etcd_service_discovery.go#L230-L247

That's really great! I nearly made a mistake.😂