// done is called when the PendingItem processing is done.
//
// It can be because there was an error, it was linked to another item, it was
// present on the server or finally it was uploaded successfully.
9626
func (i *PendingItem) done() error {
	tracer.CounterAdd(i.a, "itemsProcessing", -1)
	i.a = nil
	return nil
}
562332
func (d *decoder) finished() bool {
	return d.br.finished() && d.dt[d.state].nbBits > 0
}
1014182
func (a *MachineAgent) Done(err error) {
	a.errReason = err
	close(a.dead)
}
791303
func (a *ActionAPI) ListCompleted(arg params.Entities) (params.ActionsByReceivers, error) {
	if err := a.checkCanRead(); err != nil {
		return params.ActionsByReceivers{}, errors.Trace(err)
	}

	return a.internalList(arg, completedActions)
}
199081
func (m *Mocker) Done() bool {
	m.mutex.Lock()
	defer m.mutex.Unlock()
	return m.disabled || (!m.request.Persisted && m.request.Counter == 0)
}
1334985
func (c *cipdSubcommand) done(result interface{}, err error) int {
	err = c.writeJSONOutput(result, err)
	if err != nil {
		c.printError(err)
		return 1
	}
	return 0
}
823523
func (t *servingTask) done() uint64 {
	t.servingTime += uint64(mclock.Now())
	close(t.token)
	return t.servingTime
}
749787
func (g *deploymentGroup) Done() bool {
	completed := true
	for _, deployment := range g.deployments {
		completed = completed && (deployment.status.code == OK)
	}

	return completed
}
1075636
func (chunk *Chunk) Done() {
	for linenum, rx := range chunk.wantErrs {
		chunk.report.Errorf("%s:%d: expected error matching %q", chunk.filename, linenum, rx)
	}
}
724933
func (l *TimedLooper) Done(err error) {
	if l.DoneChan != nil {
		l.DoneChan <- err
	}
}
352282
func (r *BulkResponse) Succeeded() []*BulkResponseItem {
	if r.Items == nil {
		return nil
	}
	succeeded := make([]*BulkResponseItem, 0)
	for _, item := range r.Items {
		for _, result := range item {
			if result.Status >= 200 && result.Status <= 299 {
				succeeded = append(succeeded, result)
			}
		}
	}
	return succeeded
}
803751
func (ev *DoneChannel) Done(err error) {
	if ev.DoneChan != nil {
		select {
		case ev.DoneChan <- err:
			// sent successfully
		default:
			logrus.DefaultLogger().Debug("Nobody is listening anymore")
		}
	} else if err != nil {
		logrus.DefaultLogger().Error(err)
	}
}
1243794
func (p *Pool) Done() {
	p.mutex.Lock()
	defer p.mutex.Unlock()
	p.wg.Done()
	p.counter--
}
457855
func (op *DestroyRemoteApplicationOperation) Done(err error) error {
	if err != nil {
		if !op.Force {
			return errors.Annotatef(err, "cannot destroy remote application %q", op.app)
		}
		op.AddError(errors.Errorf("force destroy of remote application %v failed but proceeded despite encountering ERROR %v", op.app, err))
	}
	return nil
}
47004
func (w *Wrapped) done(err error) {
	w.once.Do(w.init)
	w.cancelLock.Lock()

	// Set the result
	w.resultErr = err
	w.resultSet = true

	// Notify any waiters
	w.cancelCond.Broadcast()

	// Unlock since the next call can be blocking
	w.cancelLock.Unlock()

	// Notify any channel listeners
	w.errCh <- err
}
442225
func (twg *TimeoutWaitGroup) Done() {
	twg.mutex.Lock()
	defer twg.mutex.Unlock()
	twg.workers--
	if twg.workers < 0 {
		panic("TimeoutWaitGroup: negative counter")
	}
	if twg.workers == 0 && twg.last != nil {
		close(twg.last)
	}
}
623326
func (op *DestroyUnitOperation) Done(err error) error {
	if err != nil {
		if !op.Force {
			return errors.Annotatef(err, "cannot destroy unit %q", op.unit)
		}
		op.AddError(errors.Errorf("force destroy unit %q proceeded despite encountering ERROR %v", op.unit, err))
	}
	if err := op.eraseHistory(); err != nil {
		if !op.Force {
			logger.Errorf("cannot delete history for unit %q: %v", op.unit.globalKey(), err)
		}
		op.AddError(errors.Errorf("force erase unit's %q history proceeded despite encountering ERROR %v", op.unit.globalKey(), err))
	}
	return nil
}