http-client: Reset cache TTL upon 304 "Not Modified" responses.
* guix/http-client.scm (http-fetch/cached)[update-cache]: Add call to 'utime' in the 304 case.
This commit is contained in:
		
							parent
							
								
									4f80158db0
								
							
						
					
					
						commit
						06acf6b52f
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
					@ -321,7 +321,9 @@ Raise an '&http-get-error' condition if downloading fails."
 | 
				
			||||||
      ;; Update the cache and return an input port.
 | 
					      ;; Update the cache and return an input port.
 | 
				
			||||||
      (guard (c ((http-get-error? c)
 | 
					      (guard (c ((http-get-error? c)
 | 
				
			||||||
                 (if (= 304 (http-get-error-code c)) ;"Not Modified"
 | 
					                 (if (= 304 (http-get-error-code c)) ;"Not Modified"
 | 
				
			||||||
                     cache-port
 | 
					                     (begin
 | 
				
			||||||
 | 
					                       (utime file)               ;update FILE's mtime
 | 
				
			||||||
 | 
					                       cache-port)
 | 
				
			||||||
                     (raise c))))
 | 
					                     (raise c))))
 | 
				
			||||||
        (let ((port (http-fetch uri #:text? text?
 | 
					        (let ((port (http-fetch uri #:text? text?
 | 
				
			||||||
                                #:headers headers)))
 | 
					                                #:headers headers)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue