Add finalizer to remove temporary session files.
This commit is contained in:
		
							parent
							
								
									48290e2f83
								
							
						
					
					
						commit
						b7133f4393
					
				|  | @ -10,6 +10,7 @@ | ||||||
| 	locks | 	locks | ||||||
| 	let-opt | 	let-opt | ||||||
| 	receiving | 	receiving | ||||||
|  | 	primitives | ||||||
| 	) | 	) | ||||||
|   (begin |   (begin | ||||||
| 
 | 
 | ||||||
|  | @ -206,7 +207,6 @@ plot '~a' title 'Servlet Profiling ~a' with lines" | ||||||
| 	       (state:file-names-to-delete state))))) | 	       (state:file-names-to-delete state))))) | ||||||
| 
 | 
 | ||||||
|     (define (delete-files state) |     (define (delete-files state) | ||||||
|       (format #t "running delete-files with state ~a~%" (state:file-names-to-delete state)) |  | ||||||
|       (let ((file-names-to-delete (state:file-names-to-delete state))) |       (let ((file-names-to-delete (state:file-names-to-delete state))) | ||||||
| 	(if file-names-to-delete | 	(if file-names-to-delete | ||||||
| 	    (for-each delete-filesys-object file-names-to-delete)))) | 	    (for-each delete-filesys-object file-names-to-delete)))) | ||||||
|  | @ -235,6 +235,8 @@ plot '~a' title 'Servlet Profiling ~a' with lines" | ||||||
|       (set! gnuplot (search-gnuplot)) |       (set! gnuplot (search-gnuplot)) | ||||||
|       (set-servlet-data! (make-state #f #f 0)) |       (set-servlet-data! (make-state #f #f 0)) | ||||||
|       (reset-profiling-state!) |       (reset-profiling-state!) | ||||||
|  |       ;; Remove state files if user did not do it. | ||||||
|  |       (add-finalizer! (get-servlet-data) delete-files) | ||||||
|       (profile req)) |       (profile req)) | ||||||
| 
 | 
 | ||||||
|     (define (search-gnuplot) |     (define (search-gnuplot) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 interp
						interp