Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longévité des snippets #5

Closed
3 tasks done
Aakodal opened this issue Oct 28, 2020 · 12 comments
Closed
3 tasks done

Longévité des snippets #5

Aakodal opened this issue Oct 28, 2020 · 12 comments
Assignees
Projects

Comments

@Aakodal
Copy link
Member

Aakodal commented Oct 28, 2020

Au lieu de limiter les snippets dans le temps, nous avons décider de limiter la taille de la base de donnée Redis. Ainsi, lorsque l'usage mémoire sera trop conséquent (valeur à déterminer), les snippets peu lus et plus anciens seront supprimés pour laisser place aux nouveaux. Cela sera réalisable grâce au mécanisme LRU de Redis.

Les snippets pourront tout de même avoir une limite de temps choisie par l'utilisateur, qui sera définie par défaut sur 1 semaine, et aussi une limite d'utilisations qui sera par défaut infinie.

À faire :

  • Limite d'utilisation des snippets
  • Limite de temps de vie des snippets
  • Limite de la taille de la base de données (À faire localement sur la bdd)
@Aakodal Aakodal created this issue from a note in rtd-bin (Backlog) Oct 28, 2020
@Aakodal Aakodal added the base label Oct 28, 2020
wyx0-xyz pushed a commit that referenced this issue Oct 29, 2020
Macos users:
    [Installing redis]
        ~ with brew (https://brew.sh): open your terminal and write => brew install redis
        ~ without brew: you need also open your terminal and write
            => wget https://download.redis.io/releases/redis-6.0.9.tar.gz
            => tar xzf redis-6.0.9.tar.gz
            => cd redis-6.0.9
            => make

    [Starting redis]
        ~ with brew: write => brew services start redis
            if server successfully you will receive:
                ==> Successfully started `redis` (label: homebrew.mxcl.redis)
        ~ without brew: write => src/redis-server

    [Verifying if redis is running]
        ~ only with brew: write => redis-cli ping <= if the reply is "PONG" then you are good to go

    [Stopping redis]
        ~ with brew: write => brew services stop redis
        ~ without brew: juste CTRL+C the execution
Julien00859 pushed a commit that referenced this issue Oct 30, 2020
Macos users:
    [Installing redis]
        ~ with brew (https://brew.sh): open your terminal and write => brew install redis
        ~ without brew: you need also open your terminal and write
            => wget https://download.redis.io/releases/redis-6.0.9.tar.gz
            => tar xzf redis-6.0.9.tar.gz
            => cd redis-6.0.9
            => make

    [Starting redis]
        ~ with brew: write => brew services start redis
            if server successfully you will receive:
                ==> Successfully started `redis` (label: homebrew.mxcl.redis)
        ~ without brew: write => src/redis-server

    [Verifying if redis is running]
        ~ only with brew: write => redis-cli ping <= if the reply is "PONG" then you are good to go

    [Stopping redis]
        ~ with brew: write => brew services stop redis
        ~ without brew: juste CTRL+C the execution
@Nauhai Nauhai moved this from Backlog to To do in rtd-bin Oct 30, 2020
@Nauhai Nauhai moved this from To do to In progress in rtd-bin Oct 30, 2020
@Nauhai Nauhai self-assigned this Oct 30, 2020
@Nauhai
Copy link
Collaborator

Nauhai commented Oct 30, 2020

On met sur combien la taille maximale de la db ?

@Julien00859
Copy link
Member

200 Mo ? Ce sera large.

@Nauhai
Copy link
Collaborator

Nauhai commented Oct 30, 2020

Ok de toute façon ça c'est sur la bdd directement qu'il foudra le configurer.

@Julien00859
Copy link
Member

On peut fournir un fichier de configuration d'exemple avec les instructions sur comment l'utiliser. On peut faire une page dans le wiki pour ça :)

@Nauhai
Copy link
Collaborator

Nauhai commented Oct 30, 2020

Yep ça me serait utile merci 👌
Et aussi faudrait qu'on fixe #19 au plus vite mais j'ai vraiment rien trouvé sur internet.

@Nauhai Nauhai linked a pull request Oct 31, 2020 that will close this issue
Julien00859 pushed a commit that referenced this issue Nov 1, 2020
The user is now able to set a maximum number of views/uses on his
snippets. By default, this number is infinite. The user can turn off the
infinite views by unchecking the 'infinite_views checkbox and by
entering a views number in the 'max_views' input field (it has to be a
number greater than 0). Every time the snippet's page is visited, its
views left decrease, and when it gets to 0, the snippet is deleted from
the database.

Related to #5
Nauhai added a commit that referenced this issue Nov 2, 2020
The server now takes into account request's multipart file and form
posts with new default values for parameters, and errors handling with
`contextlib.suppress()` has been implemented instead of basics
try-except statements.

Todo statements has been removed as well as the code that they were
related to, like the form for snippets maxusage for which a new issue
will be created.

The in-memory database has been replaced by an error raising because it
was not convenient at all. It will be re-implemented in a better way
later for unit-testing.

Related to #5
Nauhai added a commit that referenced this issue Nov 2, 2020
The user is now able to set a maximum number of views/uses on his
snippets. By default, this number is infinite. The user can turn off the
infinite views by unchecking the 'infinite_views checkbox and by
entering a views number in the 'max_views' input field (it has to be a
number greater than 0). Every time the snippet's page is visited, its
views left decrease, and when it gets to 0, the snippet is deleted from
the database.

Related to #5
Nauhai added a commit that referenced this issue Nov 2, 2020
The server now takes into account request's multipart file and form
posts with new default values for parameters, and errors handling with
`contextlib.suppress()` has been implemented instead of basics
try-except statements.

Todo statements has been removed as well as the code that they were
related to, like the form for snippets maxusage for which a new issue
will be created.

The in-memory database has been replaced by an error raising because it
was not convenient at all. It will be re-implemented in a better way
later for unit-testing.

Related to #5
Julien00859 pushed a commit that referenced this issue Nov 3, 2020
The user is now able to set a maximum number of views/uses on his
snippets. By default, this number is infinite. The user can turn off the
infinite views by unchecking the 'infinite_views checkbox and by
entering a views number in the 'max_views' input field (it has to be a
number greater than 0). Every time the snippet's page is visited, its
views left decrease, and when it gets to 0, the snippet is deleted from
the database.

Related to #5
Julien00859 pushed a commit that referenced this issue Nov 3, 2020
The server now takes into account request's multipart file and form
posts with new default values for parameters, and errors handling with
`contextlib.suppress()` has been implemented instead of basics
try-except statements.

Todo statements has been removed as well as the code that they were
related to, like the form for snippets maxusage for which a new issue
will be created.

The in-memory database has been replaced by an error raising because it
was not convenient at all. It will be re-implemented in a better way
later for unit-testing.

Related to #5
Nauhai added a commit that referenced this issue Nov 6, 2020
Using the Redis EXPIRE command to limit the lifetime of a snippet in
the database. This time is defined by the DEFAULT_LIFETIME_HOURS config
variable or the form's `lifetime` value or -1 if none of them is
provided which means no time limit (the lifetime should be greater
than 0 for the EXPIRE command to be applied).

Related to #5
Nauhai added a commit that referenced this issue Nov 6, 2020
Using the Redis EXPIRE command to limit the lifetime of a snippet in
the database. This time is defined by the DEFAULT_LIFETIME_HOURS config
variable or the form's `lifetime` value or -1 if none of them is
provided which means no time limit (the lifetime should be greater
than 0 for the EXPIRE command to be applied).

Related to #5
Julien00859 pushed a commit that referenced this issue Nov 6, 2020
Using the Redis EXPIRE command to limit the lifetime of a snippet in
the database. This time is defined by the DEFAULT_LIFETIME_HOURS config
variable or the form's `lifetime` value or -1 if none of them is
provided which means no time limit (the lifetime should be greater
than 0 for the EXPIRE command to be applied).

Related to #5
@Julien00859
Copy link
Member

Ne pas oublier qu'il faut ajouter un menu dans le frontend pour rendre tout ceci facilement configurable !!

@Julien00859
Copy link
Member

CC #34

@Nauhai
Copy link
Collaborator

Nauhai commented Nov 30, 2020

J'voulais le faire mais j'ai abandonné j'suis trop nul en front

@fusetim
Copy link
Member

fusetim commented Dec 5, 2020

Ne devrait-on pas fermer cette issue ?

@Julien00859
Copy link
Member

Il manque l'UI

@fusetim
Copy link
Member

fusetim commented Dec 5, 2020

En effet, je suis passé à côté

@Julien00859
Copy link
Member

Julien00859 commented Dec 26, 2020

Fixé par #53

@Mesteery Mesteery moved this from In progress to Done in rtd-bin Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

4 participants