mason: send a heartbeat even while a build is running, and tighten deadline for crashed machine in mason.server
							parent
							
								
									06e3fc84a6
								
							
						
					
					
						commit
						b3c5097862
					
				| 
						 | 
				
			
			@ -7,6 +7,11 @@ namespaces prettyprint threads ;
 | 
			
		|||
FROM: mason.build => build ;
 | 
			
		||||
IN: mason
 | 
			
		||||
 | 
			
		||||
: heartbeat-loop ( -- )
 | 
			
		||||
    notify-heartbeat
 | 
			
		||||
    5 minutes sleep
 | 
			
		||||
    heartbeat-loop ;
 | 
			
		||||
 | 
			
		||||
: fatal-error-body ( error callstack -- string )
 | 
			
		||||
    [
 | 
			
		||||
        "Fatal error on " write host-name print nl
 | 
			
		||||
| 
						 | 
				
			
			@ -19,8 +24,6 @@ IN: mason
 | 
			
		|||
     email-fatal ;
 | 
			
		||||
 | 
			
		||||
: build-loop ( -- )
 | 
			
		||||
    notify-heartbeat
 | 
			
		||||
 | 
			
		||||
    [
 | 
			
		||||
        builds-dir get make-directories
 | 
			
		||||
        builds-dir get [
 | 
			
		||||
| 
						 | 
				
			
			@ -35,4 +38,9 @@ IN: mason
 | 
			
		|||
 | 
			
		||||
    build-loop ;
 | 
			
		||||
 | 
			
		||||
MAIN: build-loop
 | 
			
		||||
: mason ( -- * )
 | 
			
		||||
    [ heartbeat-loop ] "Heartbeat loop" spawn
 | 
			
		||||
    [ build-loop ] "Build loop" spawn
 | 
			
		||||
    stop ;
 | 
			
		||||
 | 
			
		||||
MAIN: mason
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +73,7 @@ counter "COUNTER" {
 | 
			
		|||
 | 
			
		||||
: funny-builders ( -- crashed broken limbo )
 | 
			
		||||
    builder new select-tuples
 | 
			
		||||
    [ [ current-timestamp>> 5 hours ago before? ] filter ]
 | 
			
		||||
    [ [ current-timestamp>> 1 hours ago before? ] filter ]
 | 
			
		||||
    [ [ clean-timestamp>> 1 weeks ago before? ] filter ]
 | 
			
		||||
    [ [ [ clean-git-id>> ] [ release-git-id>> ] bi = not ] filter ]
 | 
			
		||||
    tri ;
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ counter "COUNTER" {
 | 
			
		|||
: mason-db ( -- db ) "resource:mason.db" <sqlite-db> ;
 | 
			
		||||
 | 
			
		||||
: with-mason-db ( quot -- )
 | 
			
		||||
    [ mason-db ] dip with-db ; inline
 | 
			
		||||
    mason-db [ with-transaction ] with-db ; inline
 | 
			
		||||
 | 
			
		||||
: init-mason-db ( -- )
 | 
			
		||||
    { builder counter } ensure-tables ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue