Use init-time creation only of StorageCounter to use less inotify instances
This commit is contained in:
parent
bbc9646a25
commit
cd0b69b03f
4 changed files with 7 additions and 5 deletions
|
@ -25,6 +25,7 @@ from etc.onionrvalues import DATABASE_LOCK_TIMEOUT
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
storage_counter = storagecounter.StorageCounter()
|
||||
|
||||
|
||||
def remove_block(block):
|
||||
|
@ -42,6 +43,6 @@ def remove_block(block):
|
|||
conn.commit()
|
||||
conn.close()
|
||||
dataSize = sys.getsizeof(onionrstorage.getData(block))
|
||||
storagecounter.StorageCounter().remove_bytes(dataSize)
|
||||
storage_counter.remove_bytes(dataSize)
|
||||
else:
|
||||
raise onionrexceptions.InvalidHexHash
|
||||
|
|
|
@ -27,11 +27,11 @@ from etc.onionrvalues import DATABASE_LOCK_TIMEOUT
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
storage_counter = storagecounter.StorageCounter()
|
||||
|
||||
|
||||
def set_data(data) -> str:
|
||||
"""Set the data assciated with a hash."""
|
||||
storage_counter = storagecounter.StorageCounter()
|
||||
data = data
|
||||
dataSize = sys.getsizeof(data)
|
||||
nonce_hash = crypto.hashers.sha3_hash(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue