Browse Source

WIP change for light weight self update

master
Macoy Madson 2 months ago
parent
commit
c2f8a56302
  1. 25
      src/AutoUpdateApplication.cake

25
src/AutoUpdateApplication.cake

@ -5,9 +5,13 @@
"CHelpers.cake" "RunProcess.cake"
;; GameLib
"Introspection.cake" "TaskSystem.cake" "AutoUpdate.cake" "OpenSSL.cake" "Curl.cake"
"DynamicArray.cake" "VersionedData.cake"
;; For time
"SDL.cake")
"DynamicArray.cake" "VersionedData.cake")
(comptime-cond
('Auto-Update-No-SDL (ignore))
(true
;; For time
"SDL.cake"))
(c-import "<stdlib.h>" "<string.h>") ;; malloc, memset
@ -87,7 +91,11 @@
(when (self-update-is-throttling)
(fprintf stderr "Self-update request ignored (throttling)\n")
(return))
(set s-last-time-checked-for-update (get-time-since-startup))
(comptime-cond
('Auto-Update-No-SDL (ignore))
(true
(set s-last-time-checked-for-update (get-time-since-startup))))
;; Automatically provision CURL if none was provided
;; Lazily initialize so we don't hit the network unless they actually ask
@ -135,9 +143,12 @@
;; Make sure the user doesn't kill my server
(defun self-update-is-throttling (&return bool)
(unless s-last-time-checked-for-update (return false))
(var current-time float (get-time-since-startup))
(return (< (- current-time s-last-time-checked-for-update) s-self-update-throttle-interval-seconds)))
(comptime-cond
('Auto-Update-No-SDL (return false))
(true
(unless s-last-time-checked-for-update (return false))
(var current-time float (get-time-since-startup))
(return (< (- current-time s-last-time-checked-for-update) s-self-update-throttle-interval-seconds)))))
(comptime-cond
('Unix

Loading…
Cancel
Save