velodrome/transform/transform.go
func (config *transformConfig) run(plugin plugins.Plugin) error {
	if err := config.CheckRootFlags(); err != nil {
		return err
	}

	mysqldb, err := config.MySQLConfig.CreateDatabase()
	if err != nil {
		return err
	}

	influxdb, err := config.InfluxConfig.CreateDatabase(
		map[string]string{"repository": config.repository},
		config.metricName)
	if err != nil {
		return err
	}

	fetcher := NewFetcher(config.repository)

	// Plugins constantly wait for new issues/events/comments
	go Dispatch(plugin, influxdb, fetcher.IssuesChannel,
		fetcher.EventsCommentsChannel)

	ticker := time.Tick(time.Hour / time.Duration(config.frequency))
	for {
		// Fetch new events from MySQL, push it to plugins
		if err := fetcher.Fetch(mysqldb); err != nil {
			return err
		}
		if err := influxdb.PushBatchPoints(); err != nil {
			return err
		}

		if config.once {
			break
		}
		<-ticker
	}

	return nil
}
func (config *transformConfig) run(plugin plugins.Plugin) error {
	if err := config.CheckRootFlags(); err != nil {
		return err
	}

	mysqldb, err := config.MySQLConfig.CreateDatabase()
	if err != nil {
		return err
	}

	influxdb, err := config.InfluxConfig.CreateDatabase(
		map[string]string{"repository": config.repository},
		config.metricName)
	if err != nil {
		return err
	}

	fetcher := NewFetcher(config.repository)

	// Plugins constantly wait for new issues/events/comments
	go Dispatch(plugin, influxdb, fetcher.IssuesChannel,
		fetcher.EventsCommentsChannel)

	ticker := time.Tick(time.Hour / time.Duration(config.frequency))
	for {
		// Fetch new events from MySQL, push it to plugins
		if err := fetcher.Fetch(mysqldb); err != nil {
			return err
		}
		if err := influxdb.PushBatchPoints(); err != nil {
			return err
		}

		if config.once {
			break
		}
		<-ticker
	}

	return nil
}
// Plugins constantly wait for new issues/events/comments