@@ -261,25 +261,25 @@ func (x *executor) do(ctx context.Context, task *Task) (err error) {
261261		return 
262262	}
263263
264+ 	// Build the changeset spec. 
265+ 	spec  :=  createChangesetSpec (task , string (diff ), x .features )
266+ 
267+ 	// Add to the cache. We don't use runCtx here because we want to write to 
268+ 	// the cache even if we've now reached the timeout. 
269+ 	if  err  =  x .cache .Set (ctx , cacheKey , spec ); err  !=  nil  {
270+ 		err  =  errors .Wrapf (err , "caching result for %q" , task .Repository .Name )
271+ 	}
272+ 
264273	// If the steps didn't result in any diff, we don't need to add it to the 
265274	// list of specs that are displayed to the user and send to the server. 
266275	if  len (diff ) ==  0  {
267276		x .updateTaskStatus (task , status )
268277		return 
269278	}
270279
271- 	// Build the changeset spec. 
272- 	spec  :=  createChangesetSpec (task , string (diff ), x .features )
273- 
274280	status .ChangesetSpec  =  spec 
275281	x .updateTaskStatus (task , status )
276282
277- 	// Add to the cache. We don't use runCtx here because we want to write to 
278- 	// the cache even if we've now reached the timeout. 
279- 	if  err  =  x .cache .Set (ctx , cacheKey , spec ); err  !=  nil  {
280- 		err  =  errors .Wrapf (err , "caching result for %q" , task .Repository .Name )
281- 	}
282- 
283283	// Add the spec to the executor's list of completed specs. 
284284	x .specsMu .Lock ()
285285	x .specs  =  append (x .specs , spec )
0 commit comments