Adding limit to the number of stored files.

This commit is contained in:
Marat Fayzullin 2023-02-21 23:05:11 -05:00
parent 7a56366cbf
commit 89bc51b1f9
4 changed files with 12 additions and 4 deletions

View File

@ -162,6 +162,7 @@ defaultConfig = PropertyLayer(
callsign_url="https://www.qrzcq.com/call/{}", callsign_url="https://www.qrzcq.com/call/{}",
usage_policy_url="policy", usage_policy_url="policy",
session_timeout=0, session_timeout=0,
keep_files=20,
decoding_queue_workers=2, decoding_queue_workers=2,
decoding_queue_length=10, decoding_queue_length=10,
wsjt_decoding_depth=3, wsjt_decoding_depth=3,

View File

@ -25,7 +25,7 @@ class FilesController(WebpageController):
for f in files[keepN:]: for f in files[keepN:]:
try: try:
os.unlink(dir + "/" + f) os.unlink(dir + "/" + f)
except: except Exception:
pass pass
def template_variables(self): def template_variables(self):

View File

@ -70,18 +70,24 @@ class GeneralSettingsController(SettingsFormController):
NumberInput( NumberInput(
"max_clients", "max_clients",
"Maximum number of clients", "Maximum number of clients",
infotext="Number of people who can connect at the same time.",
),
NumberInput(
"keep_files",
"Maximum number of files",
infotext="Number of received images and other files to keep.",
), ),
NumberInput( NumberInput(
"session_timeout", "session_timeout",
"Session timeout", "Session timeout",
infotext="User session timeout in seconds (0 to disable timeout).", infotext="Client session timeout in seconds (0 to disable timeout).",
append="secs", append="secs",
), ),
TextInput( TextInput(
"usage_policy_url", "usage_policy_url",
"Usage policy URL", "Usage policy URL",
infotext="Specifies web page describing receiver usage policy " infotext="Specifies web page describing receiver usage policy "
+ "and shown when the user session times out.", + "and shown when a client session times out.",
), ),
), ),
Section( Section(

View File

@ -19,7 +19,8 @@ class ReceiverDetails(PropertyFilter):
"photo_title", "photo_title",
"photo_desc", "photo_desc",
"usage_policy_url", "usage_policy_url",
"session_timeout", "session_timeout",
"keep_files",
) )
) )