Skip to content

Commit

Permalink
Merge pull request #91 from wildfoundry/fix-uploads
Browse files Browse the repository at this point in the history
fix bug uploading files
  • Loading branch information
rkados authored May 8, 2023
2 parents 8fd1e37 + 96128f9 commit 3e0b46f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dataplicity/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.5.9"
__version__ = "0.5.10"

if __name__ == "__main__":
# The build script uses this to extract the current version
Expand Down
4 changes: 2 additions & 2 deletions dataplicity/clockcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


CHECK_PERIOD = 1.0
MAX_CLOCK_DISCREPENCY = 10.0
MAX_CLOCK_DISCREPANCY = 180.0


class ClockCheckThread(Thread):
Expand All @@ -34,7 +34,7 @@ def run(self):
sleep(CHECK_PERIOD)
elapsed = time() - start

if elapsed > MAX_CLOCK_DISCREPENCY:
if elapsed > MAX_CLOCK_DISCREPANCY:
self.on_fail()

def on_fail(self):
Expand Down
1 change: 1 addition & 0 deletions dataplicity/m2m/packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class WriteRemoteFileResult(M2MPacket):
attributes = [
("id", bytes),
("position", int),
("chunk_size", int),
("device_path", bytes),
("fail", int),
("fail_reason", bytes),
Expand Down
5 changes: 5 additions & 0 deletions dataplicity/remote_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina
client.send(
PacketType.write_remote_file_result,
id,
offset,
len(data),
device_path,
1,
str(error).encode("utf-8", "replace"),
Expand All @@ -337,6 +339,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina
PacketType.write_remote_file_result,
id,
offset,
len(data),
device_path,
2,
str(error).encode("utf-8", "replace"),
Expand All @@ -357,6 +360,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina
PacketType.write_remote_file_result,
id,
offset,
len(data),
device_path,
3,
str(error).encode("utf-8", "replace"),
Expand All @@ -368,6 +372,7 @@ def on_write_remote_file(self, client, id, path, device_path, offset, data, fina
PacketType.write_remote_file_result,
id,
offset + len(data),
len(data),
device_path,
0,
b"",
Expand Down

0 comments on commit 3e0b46f

Please sign in to comment.