Megatest

Check-in [f0c7e06411]
Login
Overview
Comment:Sync should not be called if some other process has called it recently
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: f0c7e064119054097c3a10656c509d0a89a602fd
User & Date: matt on 2017-06-02 07:22:34
Other Links: branch diff | manifest | tags
Context
2017-06-02
09:54
Added little more feedback for sync. Return numbers as numbers from no-sync metadata check-in: 8528e93d3c user: mrwellan tags: v1.64, v1.6417
07:22
Sync should not be called if some other process has called it recently check-in: f0c7e06411 user: matt tags: v1.64
00:58
Bumped delay for sync to 6 seconds check-in: 139076d39f user: matt tags: v1.64
Changes

Modified db.scm from [89c961e6e8] to [e9a95e918d].

1043
1044
1045
1046
1047
1048
1049

1050

1051
1052
1053






1054

1055
1056


1057
1058
1059
1060
1061
1062
1063
1043
1044
1045
1046
1047
1048
1049
1050

1051



1052
1053
1054
1055
1056
1057
1058
1059


1060
1061
1062
1063
1064
1065
1066
1067
1068







+
-
+
-
-
-
+
+
+
+
+
+

+
-
-
+
+







;;    if #f use *db-local-sync* : or 'local-sync-flags
;;    if #t use timestamps      : or 'timestamps
(define (db:sync-to-megatest.db dbstruct #!key (no-sync-db #f)) 
  (let* ((start-time         (current-seconds))
	 (last-update        (if no-sync-db
				 (db:no-sync-get/default no-sync-db "LAST_UPDATE" 0)
				 0)) ;; (or (db:get-var dbstruct "LAST_UPDATE") 0))
	 (sync-needed        (> (- start-time last-update) 6))
	 (res                (db:tmp->megatest.db-sync dbstruct last-update)))
	 (res                (if sync-needed ;; don't sync if a sync already occurred in the past 6 seconds
    (let ((sync-time (- (current-seconds) start-time)))
      (if no-sync-db
	  (db:no-sync-set no-sync-db "LAST_UPDATE" start-time))
				 (begin
				   (if no-sync-db
				       (db:no-sync-set no-sync-db "LAST_UPDATE" start-time))
				   (db:tmp->megatest.db-sync dbstruct last-update))
				 0))
	 (sync-time           (- (current-seconds) start-time)))
      (debug:print-info 3 *default-log-port* "Sync of newdb to olddb completed in " sync-time " seconds pid="(current-process-id))
      (if sync-needed
      (if (common:low-noise-print 30 "sync new to old")
	  (debug:print-info 0 *default-log-port* "Sync of newdb to olddb completed in " sync-time " seconds pid="(current-process-id))))
	  ;;     (common:low-noise-print 30 "sync new to old"))
	  (debug:print-info 0 *default-log-port* "Sync of " res " records from newdb to olddb completed in " sync-time " seconds pid="(current-process-id)))
    res))

;; keeping it around for debugging purposes only
(define (open-run-close-no-exception-handling  proc idb . params)
  (debug:print-info 11 *default-log-port* "open-run-close-no-exception-handling START given a db=" (if idb "yes " "no ") ", params=" params)
  (print "I don't work anymore. open-run-close-no-exception-handling needs fixing or removing...")
  (exit)