summaryrefslogtreecommitdiff
path: root/src/bidding_data.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-11-15 01:24:53 +0100
committeremkael <emkael@tlen.pl>2016-11-15 01:24:53 +0100
commit5454fcf7d11f2fe74233d53701bac9d9971f2480 (patch)
treea00c2a650a68c0c84c8d5ea8e18e20952bc14a79 /src/bidding_data.py
parentb9bd2cf83fbc9e463d9c04308c66966314f51772 (diff)
* not sending anything to Goniec if file list is empty
Diffstat (limited to 'src/bidding_data.py')
-rw-r--r--src/bidding_data.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/bidding_data.py b/src/bidding_data.py
index fddcafe..42003c0 100644
--- a/src/bidding_data.py
+++ b/src/bidding_data.py
@@ -568,28 +568,31 @@ class JFRBidding(object):
path.exists(file_to_send) and
(file_to_send in changed_files or
self.__goniec['force_resend'])]
- try:
- goniec_socket = socket.socket()
- goniec_socket.connect((
- self.__goniec['host'],
- self.__goniec['port']))
- log.getLogger('goniec').info(
- 'connected to Goniec at %s:%d',
- self.__goniec['host'], self.__goniec['port'])
- content_lines = [working_directory] + \
- files_to_send + ['bye', '']
- goniec_socket.sendall('\n'.join(
- [line.encode(sys.getfilesystemencoding())
- for line in content_lines]))
- log.getLogger('goniec').info(
- 'working directory is: %s', working_directory)
- goniec_socket.close()
- for file_sent in files_to_send:
+ if len(files_to_send) > 0:
+ try:
+ goniec_socket = socket.socket()
+ goniec_socket.connect((
+ self.__goniec['host'],
+ self.__goniec['port']))
log.getLogger('goniec').info(
- 'sent file to Goniec: %s', file_sent)
- except socket.error as err:
- log.getLogger('goniec').error(
- 'unable to connect to Goniec: %s', err)
+ 'connected to Goniec at %s:%d',
+ self.__goniec['host'], self.__goniec['port'])
+ content_lines = [working_directory] + \
+ files_to_send + ['bye', '']
+ goniec_socket.sendall('\n'.join(
+ [line.encode(sys.getfilesystemencoding())
+ for line in content_lines]))
+ log.getLogger('goniec').info(
+ 'working directory is: %s', working_directory)
+ goniec_socket.close()
+ for file_sent in files_to_send:
+ log.getLogger('goniec').info(
+ 'sent file to Goniec: %s', file_sent)
+ except socket.error as err:
+ log.getLogger('goniec').error(
+ 'unable to connect to Goniec: %s', err)
+ else:
+ log.getLogger('goniec').info('nothing to send')
def main():