Handle shutdown gracefully
[candle] / src / main / aws / aws.lisp
index 1d3745b27cd59886ad20722d5332710c0ca5b3ad..2913d3244492dc5f9ca8c259c2ad4a8eff6c521b 100644 (file)
@@ -26,6 +26,7 @@
    (values-list retn))))
 
 (defun start-shutdown-thread ()
+ (format t "Starting AWS shutdown thread~%")
  (sb-thread:make-thread
   (lambda ()
    (loop
     (sleep 30)))
   :name "AWS Shutdown Thread"))
 
+(defmethod candle:shutdown-system ((job-system (eql :aws)))
+ (format t "Shutting down AWS box for exit~%")
+ ; If there's a job going, we need to wait for it to finish
+ (sb-thread:with-mutex (*aws-mutex*))
+ (stop-aws-box))
+
 (defun aws-command (cmd &rest args)
  (with-output-to-string (out)
  (sb-ext:run-program