Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
controller: create context earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 authored Jan 9, 2021
1 parent 66ed78c commit 3e3ae97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func (controller *Controller) onVerifyButtonClicked() {
go func() {
var err error

// Create context
controller.ctx, controller.cancel = context.WithCancel(context.Background())
defer controller.cancel()

// Initial UI updates when verification starts
glib.IdleAdd(func() {
controller.View.ButtonStack.SetVisibleChild(controller.View.CancelButton)
Expand Down Expand Up @@ -115,10 +119,6 @@ func (controller *Controller) onVerifyButtonClicked() {
return
}

// Create context
controller.ctx, controller.cancel = context.WithCancel(context.Background())
defer controller.cancel()

// Compute file hash
hashValueComputed, err := controller.Model.ComputeHash(controller.ctx, filePath)
if err != nil {
Expand Down

0 comments on commit 3e3ae97

Please sign in to comment.