func (w *Worker) Start() {
	go func() {
		w.Work()
	}()
}
Start to start a worker
package worker
import (
	"fmt"
	"math"
	"regexp"
	"strconv"
	"sync/atomic"
	"time"
	"github.com/didi/falcon-log-agent/strategy"
	"github.com/didi/falcon-log-agent/common/dlog"
	"github.com/didi/falcon-log-agent/common/g"
	"github.com/didi/falcon-log-agent/common/proc/metric"
	"github.com/didi/falcon-log-agent/common/sample_log"
	"github.com/didi/falcon-log-agent/common/scheme"
	"github.com/didi/falcon-log-agent/common/utils"
)
type callbackHandler func(int64, int64)
type Worker struct {
	FilePath  string
	Counter   int64
	LatestTms int64  
	Delay     int64  
	Close     chan struct{}
	Stream    chan string
	Mark      string  
	Analyzing bool    
	Callback  callbackHandler
}
type WorkerGroup struct {
	WorkerNum          int
	LatestTms          int64  
	MaxDelay           int64  
	ResetTms           int64  
	Workers            []*Worker
	TimeFormatStrategy string
}
func (wg WorkerGroup) GetLatestTmsAndDelay() (tms int64, delay int64) {
	return wg.LatestTms, wg.MaxDelay
}
func (wg *WorkerGroup) SetLatestTmsAndDelay(tms int64, delay int64) {
	latest := atomic.LoadInt64(&wg.LatestTms)
	if latest < tms {
		swapped := atomic.CompareAndSwapInt64(&wg.LatestTms, latest, tms)
		if swapped {
			dlog.Debugf("[work group:%s][set latestTms:%d]", wg.Workers[0].Mark, tms)
		}
	}
	if delay == 0 {
		return
	}
	newest := atomic.LoadInt64(&wg.MaxDelay)
	if newest < delay {
		atomic.CompareAndSwapInt64(&wg.MaxDelay, newest, delay)
	}
}
func NewWorkerGroup(filePath string, stream chan string, st *scheme.Strategy) *WorkerGroup {
	wg := &WorkerGroup{
		WorkerNum: g.Conf().Worker.WorkerNum,
		Workers:   make([]*Worker, 0),
	}
	dlog.Infof("new worker group, [file:%s][worker_num:%d]", filePath, g.Conf().Worker.WorkerNum)
	for i := 0; i < wg.WorkerNum; i++ {
		mark := fmt.Sprintf("[worker][file:%s][num:%d][id:%d]", filePath, g.Conf().Worker.WorkerNum, i)
		w := Worker{}
		w.Close = make(chan struct{})
		w.FilePath = filePath
		w.Stream = stream
		w.Mark = mark
		w.Analyzing = false
		w.Counter = 0
		w.LatestTms = 0
		w.Delay = 0
		w.Callback = wg.SetLatestTmsAndDelay
		wg.Workers = append(wg.Workers, &w)
	}
	return wg
}
func (wg *WorkerGroup) Start() {
	for _, worker := range wg.Workers {
		worker.Start()
	}
}
func (wg *WorkerGroup) Stop() {
	for _, worker := range wg.Workers {
		worker.Stop()
	}
}
func (wg *WorkerGroup) ResetMaxDelay() {
	ts := time.Now().Unix()
	if ts-wg.ResetTms > 86400 {
		wg.ResetTms = ts
		atomic.StoreInt64(&wg.MaxDelay, 0)
	}
}