Skip to content
Snippets Groups Projects
Unverified Commit 067ec73b authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

forgot to clean up last engine modes

parent 714fca6d
No related branches found
No related tags found
No related merge requests found
...@@ -41,17 +41,22 @@ This is an exact recreation of 0x0.st's algorithm, so I'll also steal their grap ...@@ -41,17 +41,22 @@ This is an exact recreation of 0x0.st's algorithm, so I'll also steal their grap
0 256.0 512.0 0 256.0 512.0
MiB MiB
``` ```
The numbers are a little different, depending on how your config looks, but it works the same. The numbers are a little different, depending on how your config looks, but it works the same.
```python3
stat = os.stat(os.path.join(config['UPLOAD_FOLDER'], f))
systime = time.time()
age = timedelta(seconds = systime - stat.st_mtime).days
maxage = mind + (-maxd + mind) * (stat.st_size / maxs - 1) ** 3
if age >= maxage:
delete_file(f)
```
## Engine Mode 3 (Hybrid 'Popularity' Based)
Files are deleted on a aggregate score based on size and popularity (large, popular files are kept alive longer, vs unpopular files most likely just used once)
```python3 ## Engine Mode 4 (Lazy-Hybrid 'Popularity' Based)
stat = os.stat(os.path.join(config['UPLOAD_FOLDER'], f))
systime = time.time()
age = timedelta(seconds = systime - stat.st_mtime).days
maxage = mind + (-maxd + mind) * (stat.st_size / maxs - 1) ** 3
if age >= maxage:
delete_file(f)
```
3. Hybrid 'popularity' deletion - Files are deleted on a aggregate score based on size and popularity (large, popular files are kept alive longer, vs unpopular files most likely just used once) Files are deleted on size AND last view, depending on what comes last (small files stay the same, long files have potential to stay alive longer)
4. Lazy-Hybrid 'popularity' deletion - Files are deleted on size AND last view, depending on what comes last (small files stay the same, long files have potential to stay alive longer)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment