You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cross_cluster_task_processor.go
    path of file: ./repos/cadence/service/history/task
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Uber Technologies, Inc.
//
// Permission is hereby granted
    
func (p *crossClusterTaskProcessor) processLoop() {
	defer p.shutdownWG.Done()

	for {
		if p.hasShutdown() {
			return
		}

		if p.numPendingTasks() > p.options.MaxPendingTasks() {
			time.Sleep(backoff.JitDuration(
				p.options.TaskWaitInterval(),
				p.options.TimerJitterCoefficient(),
			))
			continue
		}

		// this will submit the fetching request to the host level task fetcher for batching
		p.metricsScope.IncCounter(metrics.CrossClusterFetchRequests)
		sw := p.metricsScope.StartTimer(metrics.CrossClusterFetchLatency)

		var taskRequests []*types.CrossClusterTaskRequest
		err := p.taskFetcher.Fetch(p.shard.GetShardID()).Get(p.ctx, &taskRequests)
		sw.Stop()
		if err != nil {
			if err == errTaskFetcherShutdown {
				return
			}

			p.logger.Error("Unable to fetch cross cluster tasks", tag.Error(err))
			if common.IsServiceBusyError(err) {
				p.metricsScope.IncCounter(metrics.CrossClusterFetchServiceBusyFailures)
				time.Sleep(backoff.JitDuration(
					p.options.ServiceBusyBackoffInterval(),
					p.options.TimerJitterCoefficient(),
				))
			} else {
				p.metricsScope.IncCounter(metrics.CrossClusterFetchFailures)
				// note we rely on the aggregation interval in task fetcher as the backoff
			}
			continue
		}

		p.processTaskRequests(taskRequests)
	}
}