Skip to content

Commit 9517354

Browse files
authored
offload_data now sorts pending files by name so its more predictable. (#29)
Fixing #28 Changed the size limit for pending files to 15MB
1 parent 0d6ba60 commit 9517354

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/badge_hub.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
SCAN_DURATION = 3 # seconds
4343

4444
#NOTE try to keep under 100MB or so due to memory constraints
45-
MAX_PENDING_FILE_SIZE = 20000000 # in bytes, so 20MB
45+
MAX_PENDING_FILE_SIZE = 15000000 # in bytes, so 15MB
4646

4747
# create logger with 'badge_server'
4848
logger = logging.getLogger('badge_server')
@@ -87,9 +87,10 @@ def offload_data():
8787
#TODO test with standalone
8888
#NOTE not currently doing anything with the True/False
8989
# return values, might decide to do something later
90-
pending_files = glob.glob(pending_file_prefix + "*")
90+
pending_files = sorted(glob.glob(pending_file_prefix + "*"))
9191
for pending_file_name in pending_files:
92-
92+
logger.debug("Sending {} to server".format(pending_file_name))
93+
9394
if not has_chunks(pending_file_name):
9495
continue
9596

@@ -104,7 +105,7 @@ def offload_data():
104105
try:
105106
chunks_written = hub_manager.send_data_to_server(logger, data_type, chunks)
106107
if chunks_written == len(chunks):
107-
logger.info("Successfully wrote {} data entries to server"
108+
logger.debug("Successfully wrote {} data entries to server"
108109
.format(len(chunks)))
109110
else:
110111
# this seems unlikely to happen but is good to keep track of i guess

0 commit comments

Comments
 (0)