Changeset - b0515ceb502d
[Not reviewed]
tip default
1 4 0
Laman - 5 years ago 2020-06-07 13:28:55

actually flushing the files
5 files changed with 9 insertions and 43 deletions:
0 comments (0 inline, 0 general)
src/client.py
Show inline comments
 
@@ -167,6 +167,7 @@ class Client(NetNode):
 

	
 
					t = datetime.now().timestamp()
 
					if t-last_flushed >= 60:
 
						data_file.flush()
 
						if self._tree_file:
 
							self._update_tree()
 
						self._refresh_lock()
src/config.py
Show inline comments
 
@@ -31,5 +31,5 @@ port = conf.get("port", 9901)
 

	
 
bSize = conf.get("batch_size", dict())
 
class batch_size:
 
	hash = bSize.get("hash", 256)
 
	hash = bSize.get("hash", 16384)
 
	data = bSize.get("data", 64)
src/datafile.py
Show inline comments
 
@@ -25,5 +25,8 @@ class DataFile:
 
		self._last_index = i
 
		return self._f.read(byte_count)
 

	
 
	def flush(self):
 
		self._f.flush()
 

	
 
	def close(self):
 
		self._f.close()
src/morevna.sh
Show inline comments
 
deleted file
src/server.py
Show inline comments
 
@@ -94,7 +94,9 @@ class Server(NetNode):
 
			if json_data["action"]=="pull" and self.is_locked():
 
				self._outcoming.write_msg({"command": "deny", "status": status.locked})
 
			if json_data["action"]=="push" and not self.is_locked():
 
				self._lock()
 
				try: self._lock()
 
				except Exception:
 
					pass
 

	
 
			self._last_flushed = datetime.now().timestamp()
 
			self._outcoming.write_msg({"command": "init", "version": conf.version})
 
@@ -151,6 +153,7 @@ class Server(NetNode):
 

	
 
		t = datetime.now().timestamp()
 
		if t-self._last_flushed>=60:
 
			self._data_file.flush()
 
			if self._tree_file:
 
				self._update_tree()
 
			self._refresh_lock()
0 comments (0 inline, 0 general)