// Add sents an ADDJOB command to disque, as specified by the AddRequest. Returns the job id or an error
185605
func (c *RedisClient) Add(r AddRequest) (string, error) {
	//ADDJOB queue_name job <ms-timeout> [REPLICATE <count>] [DELAY <sec>] [RETRY <sec>] [TTL <sec>] [MAXLEN <count>] [ASYNC]

	id, err := redis.String(c.conn.Do("ADDJOB", addArgs(r)...))
	if err != nil {
		return "", errors.New("disque: could not add job: " + err.Error())
	}
	return id, nil
}
311147
func (w *Worker) Add(j Job) {
	p := NewPackage(w.getNextID(), j)

	w.jobs.Set(p)
	w.queue.Add(p)

	w.emit(jobAdded, w.jobs.Get(p.ID))
	w.emit(JobAdded, w.jobs.Get(p.ID))
}
679987
func (sm *ScriptMap) Add(scriptName string, script *Script) {
	sm.lock.Lock()
	defer sm.lock.Unlock()
	sm.scripts[scriptName] = script
}
485079
func (w *WorkPool) Add(context interface{}, do int) error {
	if do == 0 {
		return ErrInvalidAddRequest
	}

	cur := int(atomic.LoadInt64(&w.currentWorkers))

	cmd := addWorker
	if do < 0 {
		do = cur - do
		cmd = removeWorker
	}

	atomic.AddInt64(&w.updatePending, int64(do))

	for i := 0; i < do; i++ {
		w.commands <- cmd
	}

	return nil
}
1186726
func (cron *Cron) Add(job QorJobInterface) (err error) {
	cron.parseJobs()
	defer cron.writeCronJob()

	var binaryFile string
	if binaryFile, err = filepath.Abs(os.Args[0]); err == nil {
		var jobs []*cronJob
		for _, cronJob := range cron.Jobs {
			if cronJob.JobID != job.GetJobID() {
				jobs = append(jobs, cronJob)
			}
		}

		if scheduler, ok := job.GetArgument().(Scheduler); ok && scheduler.GetScheduleTime() != nil {
			scheduleTime := scheduler.GetScheduleTime().In(time.Local)
			job.SetStatus(JobStatusScheduled)

			currentPath, _ := os.Getwd()
			jobs = append(jobs, &cronJob{
				JobID:   job.GetJobID(),
				Command: fmt.Sprintf("%d %d %d %d * cd %v; %v --qor-job %v\n", scheduleTime.Minute(), scheduleTime.Hour(), scheduleTime.Day(), scheduleTime.Month(), currentPath, binaryFile, job.GetJobID()),
			})
		} else {
			cmd := exec.Command(binaryFile, "--qor-job", job.GetJobID())
			if err = cmd.Start(); err == nil {
				jobs = append(jobs, &cronJob{JobID: job.GetJobID(), Pid: cmd.Process.Pid})
				cmd.Process.Release()
			}
		}
		cron.Jobs = jobs
	}

	return
}
866004
func (c *memoryStore) Add(id string, cont *Container) {
	c.Lock()
	c.s[id] = cont
	c.Unlock()
}
947074
func (c *Host) AddJob(job *host.Job) error {
	return c.c.Put(fmt.Sprintf("/host/jobs/%s", job.ID), job, nil)
}
932958
func (a *S3Store) addJob(ctx context.Context, blockCh chan job, block []byte, partNumber int, hash string) error {
	// Create a job, unless the context has been canceled.
	select {
	case blockCh <- job{block: block, index: partNumber, hash: hash}:
		return nil
	case <-ctx.Done():
		return ctx.Err()
	}
}
1073597
func (a *Module) Add(args ...interface{}) *Module {
	for _, c := range args {
		a.AddHandler(c).Auto()
	}
	return a
}
187296
func (s *service) Add(reqDTO rest.RequestDTO) (resDTO rest.ResponseDTO, error *servicehelper.Error) {
	entity, Err := createEntityFromDTO(reqDTO, true)
	if Err != nil {
		return rest.ResponseDTO{}, Err
	} else if s.repo.Create(entity) {
		return createDTOFromEntity(entity), error
	}
	return rest.ResponseDTO{}, &servicehelper.Error{
		Detail:  errors.New("user could not be created"),
		Message: "We could not created this account because an account already use this email address",
		Param:   "email",
		Code:    servicehelper.AlreadyExist,
	}
}
1012150
func (b *Builder) Add(defs ...Def) error {
	for _, def := range defs {
		if err := b.add(def); err != nil {
			return err
		}
	}

	return nil
}
273646
func (v *View) AddJob(name string) (bool, error) {
	url := "/addJobToView"
	qr := map[string]string{"name": name}
	resp, err := v.Jenkins.Requester.Post(v.Base+url, nil, nil, qr)
	if err != nil {
		return false, err
	}
	if resp.StatusCode == 200 {
		return true, nil
	}
	return false, errors.New(strconv.Itoa(resp.StatusCode))
}
1148771
func (err *MultiError) Add(errOrNil error) {
	if err != nil && errOrNil != nil {
		*err = append(*err, errOrNil)
	}
}
1290414
func (c *Cron) Add(s Schedule, j Job) {

	entry := &Entry{
		Schedule: s,
		Job:      j,
	}

	if !c.running {
		c.entries = append(c.entries, entry)
		return
	}
	c.add <- entry
}
1327683
func (w *Walker) addJob(path string) {
	w.wg.Add(1)
	select {
	// try to push the job to the channel
	case w.jobs <- path: // ok
	default: // buffer overflow
		// process job synchronously
		w.processPath(path)
	}
}
1318141
func (idx *TruncIndex) Add(id string) error {
	idx.Lock()
	defer idx.Unlock()
	return idx.addID(id)
}
121468
func (q *Type) Add(item interface{}) {
	q.cond.L.Lock()
	defer q.cond.L.Unlock()
	if q.shuttingDown {
		return
	}
	if q.dirty.has(item) {
		return
	}
	q.dirty.insert(item)
	if q.processing.has(item) {
		return
	}
	q.queue = append(q.queue, item)
	q.cond.Signal()
}