Actually decrease amount of unnecessary writes

This commit is contained in:
Frisk 2021-11-19 13:35:36 +01:00
parent 49868527cd
commit 8631a41ef6
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 5 additions and 4 deletions

View file

@ -97,8 +97,9 @@ class DataFile:
raise
def __setitem__(self, instance, value):
self.data[instance] = value
self.changed = True
if self.data[instance] != value:
self.data[instance] = value
self.changed = True
def __getitem__(self, item):
try:

View file

@ -108,8 +108,8 @@ class Wiki(object):
last_check = self.fetch_changes(amount=amount)
if last_check is not None:
if settings["limitrefetch"] != -1:
storage["rcid"] = last_check[0] if last_check[0] and last_check[0] != storage["rcid"] else storage["rcid"]
storage["abuse_log_id"] = last_check[1] if last_check[1] and last_check[1] != storage["abuse_log_id"] else storage["abuse_log_id"]
storage["rcid"] = last_check[0] if last_check[0] else storage["rcid"]
storage["abuse_log_id"] = last_check[1] if last_check[1] else storage["abuse_log_id"]
storage.save_datafile()
else:
self.memory_id = last_check