Abandon client question on timeout before die()'ing.
The server would lock up in cases where a client left a question pending and die()'d due to this timeout. So, before die()'ing, clear the question.
This commit is contained in:
		
							parent
							
								
									10d809c180
								
							
						
					
					
						commit
						20ac3c5ef7
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -35,7 +35,12 @@ sub BeancountQuerySubmit($;$$) { | |||
|   my $cnt = 0; | ||||
|   while (not defined $BEANCOUNT_QUERY{fifoName}) { | ||||
|     sleep 1; | ||||
|     die "Unable to initiate query to beancount server\n" if ($cnt++ >= (5 * 60)); | ||||
|     if ($cnt++ >= (5 * 60)) { | ||||
|       (tied %BEANCOUNT_QUERY)->shlock; | ||||
|       $BEANCOUNT_QUERY{question} = undef; | ||||
|       (tied %BEANCOUNT_QUERY)->shunlock; | ||||
|       die "Unable to initiate query to beancount server\n" ; | ||||
|     } | ||||
|   } | ||||
|   unless (-p $BEANCOUNT_QUERY{fifoName}) { | ||||
|     (tied %BEANCOUNT_QUERY)->shlock; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn