mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-25 23:53:07 +01:00
Add more unit tests
This commit is contained in:
14 files changed
+810
-24
No files matched your search
@@ -16,6 +16,7 @@ type Queue struct {
|
||||
type Job struct {
|
||||
Name string
|
||||
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.
|
||||
@@ -44,11 +45,13 @@ func (q *Queue) AddJob(job Job) {
|
||||
}
|
||||
|
||||
// Run performs job execution.
|
||||
func (j Job) Run() error {
|
||||
func (j *Job) Run() error {
|
||||
err := j.Action()
|
||||
if err != nil {
|
||||
j.Done <- true
|
||||
return err
|
||||
}
|
||||
|
||||
j.Done <- true
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user