mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-11-04 01:15:14 +00:00 
			
		
		
		
	Fix annoying joqqueue issue where jobs were blocked by unused channel
This commit is contained in:
		@@ -16,7 +16,7 @@ var (
 | 
				
			|||||||
func Start() {
 | 
					func Start() {
 | 
				
			||||||
	ctx, cancel = context.WithCancel(context.Background())
 | 
						ctx, cancel = context.WithCancel(context.Background())
 | 
				
			||||||
	q := &Queue{
 | 
						q := &Queue{
 | 
				
			||||||
		jobs:   make(chan Job, 10),
 | 
							jobs:   make(chan Job, 50),
 | 
				
			||||||
		ctx:    ctx,
 | 
							ctx:    ctx,
 | 
				
			||||||
		cancel: cancel,
 | 
							cancel: cancel,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,6 @@ type Queue struct {
 | 
				
			|||||||
type Job struct {
 | 
					type Job struct {
 | 
				
			||||||
	Name   string
 | 
						Name   string
 | 
				
			||||||
	Action func() error // A function that should be executed when the job is running.
 | 
						Action func() error // A function that should be executed when the job is running.
 | 
				
			||||||
	Done   chan bool    // A channel that should be closed when the job is done.
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AddJobs adds jobs to the queue and cancels channel.
 | 
					// AddJobs adds jobs to the queue and cancels channel.
 | 
				
			||||||
@@ -49,12 +48,5 @@ func (q *Queue) AddJob(job Job) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Run performs job execution.
 | 
					// Run performs job execution.
 | 
				
			||||||
func (j *Job) Run() error {
 | 
					func (j *Job) Run() error {
 | 
				
			||||||
	err := j.Action()
 | 
						return j.Action()
 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		j.Done <- true
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	j.Done <- true
 | 
					 | 
				
			||||||
	return nil
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user