fix(server): Thread request context to all relevant places
Previously background contexts where created where necessary (e.g. in GCS interactions). Should I begin to use request timeouts or other context-dependent things in the future, it's useful to have the actual HTTP request context around. This threads the request context through the application to all places that need it.
This commit is contained in:
		
							parent
							
								
									30e618b65b
								
							
						
					
					
						commit
						d8fba23365
					
				
					 6 changed files with 20 additions and 23 deletions
				
			
		|  | @ -375,7 +375,7 @@ func (b *byteCounter) Write(p []byte) (n int, err error) { | |||
| // image manifest. | ||||
| func uploadHashLayer(ctx context.Context, s *State, key string, lw layerWriter) (*manifest.Entry, error) { | ||||
| 	path := "staging/" + key | ||||
| 	sha256sum, size, err := s.Storage.Persist(path, func(sw io.Writer) (string, int64, error) { | ||||
| 	sha256sum, size, err := s.Storage.Persist(ctx, path, func(sw io.Writer) (string, int64, error) { | ||||
| 		// Sets up a "multiwriter" that simultaneously runs both hash | ||||
| 		// algorithms and uploads to the storage backend. | ||||
| 		shasum := sha256.New() | ||||
|  | @ -399,7 +399,7 @@ func uploadHashLayer(ctx context.Context, s *State, key string, lw layerWriter) | |||
| 
 | ||||
| 	// Hashes are now known and the object is in the bucket, what | ||||
| 	// remains is to move it to the correct location and cache it. | ||||
| 	err = s.Storage.Move("staging/"+key, "layers/"+sha256sum) | ||||
| 	err = s.Storage.Move(ctx, "staging/"+key, "layers/"+sha256sum) | ||||
| 	if err != nil { | ||||
| 		log.WithError(err).WithField("layer", key). | ||||
| 			Error("failed to move layer from staging") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue