refactor(services): replace temporary variable pointer pattern with new() builtin
Simplify pointer creation in media scanner validation messages and worker job timestamps by using inline new() instead of local variable + address-of. In media_scanner.go this cleans up three validation error message returns (manga/comics library format checks). In worker.go it simplifies StartedAt and CompletedAt timestamp assignments.
This commit is contained in:
@@ -221,8 +221,7 @@ func (w *Worker) processJob(job *Job) {
|
||||
}
|
||||
w.mu.Unlock()
|
||||
|
||||
now := time.Now()
|
||||
job.StartedAt = &now
|
||||
job.StartedAt = new(time.Now())
|
||||
|
||||
w.mu.Lock()
|
||||
if result, exists := w.results[job.ID]; exists {
|
||||
@@ -254,8 +253,7 @@ func (w *Worker) processJob(job *Job) {
|
||||
err = fmt.Errorf("unknown job type: %s", job.Type)
|
||||
}
|
||||
|
||||
completedAt := time.Now()
|
||||
job.CompletedAt = &completedAt
|
||||
job.CompletedAt = new(time.Now())
|
||||
job.Error = err
|
||||
job.Result = result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user