// SlaveHostsCfgPoller periodically reads the slave_hosts_cfg.py file from the // repo. It does NOT update the repository; it is assumed that the caller takes // care of that. func SlaveHostsCfgPoller(workdir string) (*util.PollingStatus, error) { var v map[string]*SlaveHost return util.NewPollingStatus(&v, func(value interface{}) error { cfg, err := GetSlaveHostsCfg(workdir) if err != nil { return err } *value.(*map[string]*SlaveHost) = cfg return nil }, 5*time.Minute) }
func AutoRollStatusPoller() (*util.PollingStatus, error) { var v []*AutoRollIssue return util.NewPollingStatus(&v, func(value interface{}) error { res, err := GetLastNRolls(POLLER_ROLLS_LIMIT) if err != nil { return err } *value.(*[]*AutoRollIssue) = res return nil }, 1*time.Minute) }
// AndroidDeviceCfgPoller periodically reads the android_devices.py file from // the repo using Gitiles. func AndroidDeviceCfgPoller(workdir string) (*util.PollingStatus, error) { var v map[string]*AndroidDeviceCfg return util.NewPollingStatus(&v, func(value interface{}) error { cfg, err := GetAndroidDeviceCfg(workdir) if err != nil { return err } *value.(*map[string]*AndroidDeviceCfg) = cfg return nil }, 5*time.Minute) }
// AndroidDeviceCfgPoller periodically reads the android_devices.py file from // the repo using Gitiles. func AndroidDeviceCfgPoller(workdir string) (*util.PollingStatus, error) { return util.NewPollingStatus(func() (interface{}, error) { return GetAndroidDeviceCfg(workdir) }, 5*time.Minute) }
// PollingStatus is a convenience struct used for periodically querying // InfluxDB. func NewPollingStatus(value interface{}, query string, dbClient *Client) (*util.PollingStatus, error) { return util.NewPollingStatus(value, makePollFn(query, dbClient), time.Minute) }
// PollingStatus returns a util.PollingStatus which runs the given // query at the given interval. func (c *Client) Int64PollingStatus(query string, interval time.Duration) (*util.PollingStatus, error) { return util.NewPollingStatus(func() (interface{}, error) { return c.QueryInt64(query) }, interval) }
// SlaveHostsCfgPoller periodically reads the slave_hosts_cfg.py file from the // repo. It does NOT update the repository; it is assumed that the caller takes // care of that. func SlaveHostsCfgPoller(workdir string) (*util.PollingStatus, error) { return util.NewPollingStatus(func() (interface{}, error) { return GetSlaveHostsCfg(workdir) }, 5*time.Minute) }