Periodic tasks refactor (#62)

* Once every second the session run a list of periodic tasks on every
instance concurrently. We use these tasks to do things like:
- Collect mem and cpu stats
- Check if instance is part of a swarm cluster
- Broadcast information to connected clients
This commit is contained in:
Jonathan Leibiusky
2016-12-01 15:57:30 -03:00
committed by GitHub
parent 07fee4c1bf
commit afa47c0bfc
7 changed files with 178 additions and 101 deletions

View File

@@ -0,0 +1,8 @@
package services
type broadcastInfoTask struct {
}
func (c *broadcastInfoTask) Run(i *Instance) {
wsServer.BroadcastTo(i.session.Id, "instance stats", i.Name, i.Mem, i.Cpu, i.IsManager)
}