fix: add null check for avatar pointer before dereference in user profile loader
This commit is contained in:
+4
-5
@@ -5,11 +5,10 @@ try:
|
||||
with open('usage.log', 'a') as log_file:
|
||||
while True:
|
||||
cpu = psutil.cpu_percent(interval=1)
|
||||
mem = psutil.virtual_memory()
|
||||
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
log_entry = f"{timestamp} CPU: {cpu}% Memory: {mem.percent}%\n"
|
||||
memory = psutil.virtual_memory().percent
|
||||
log_entry = f"CPU: {cpu}%, Memory: {memory}%\n"
|
||||
log_file.write(log_entry)
|
||||
log_file.flush()
|
||||
time.sleep(4) # Already waited 1 sec in cpu_percent, so sleep 4 more to total 5
|
||||
time.sleep(4)
|
||||
except KeyboardInterrupt:
|
||||
print("Monitoring stopped by user.")"}
|
||||
print('Monitoring stopped by user.')
|
||||
Reference in New Issue
Block a user