github.com/Axway/agent-sdk@v1.1.101/pkg/jobs/detachedintervaljob.go (about)

     1  package jobs
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // newDetachedIntervalJob - creates an interval run job, detached from other cron jobs
     8  func newDetachedIntervalJob(newJob Job, interval time.Duration, name string, opts ...jobOpt) (JobExecution, error) {
     9  	thisJob := intervalJob{
    10  		createBaseJob(newJob, nil, name, JobTypeDetachedInterval),
    11  		intervalJobProps{
    12  			interval: interval,
    13  			stopChan: make(chan bool),
    14  		},
    15  	}
    16  
    17  	for _, o := range opts {
    18  		o(&thisJob.baseJob)
    19  	}
    20  
    21  	go thisJob.start()
    22  	return &thisJob, nil
    23  }