Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hydrus/client/ClientDownloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _DoMainLoop( self ):

try:

errors_occured = []
errors_occurred = []
file_successful = False

media_result = self._controller.Read( 'media_result', hash )
Expand Down Expand Up @@ -347,7 +347,7 @@ def _DoMainLoop( self ):

except Exception as e:

errors_occured.append( e )
errors_occurred.append( e )



Expand All @@ -356,11 +356,11 @@ def _DoMainLoop( self ):
total_successful_hashes_in_this_run += 1


if len( errors_occured ) > 0:
if len( errors_occurred ) > 0:

if not file_successful:

raise errors_occured[0]
raise errors_occurred[0]



Expand Down
12 changes: 12 additions & 0 deletions hydrus/server/ServerController.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import signal
import requests
import time
import traceback
Expand Down Expand Up @@ -390,6 +391,9 @@ def Run( self ):

HydrusData.Print( 'Server is running. Press Ctrl+C to quit.' )

signal.signal( signal.SIGTERM, self.CatchSignal )
signal.signal( signal.SIGINT, self.CatchSignal )

try:

while not HG.model_shutdown and not self._shutdown:
Expand Down Expand Up @@ -605,6 +609,14 @@ def ShutdownView( self ):
HydrusController.HydrusController.ShutdownView( self )


def CatchSignal( self, sig, frame ):

if sig in ( signal.SIGTERM, signal.SIGINT ):

self.ShutdownFromServer()



def ShutdownFromServer( self ):

HydrusData.Print( 'Received a server shut down request' + HC.UNICODE_ELLIPSIS )
Expand Down