Should the task state be updated  here or when the handler actually cancels the task?  Maybe both to deal with the case where  a running task could override this state.