I would like URLs to expire after 30 days. However, rather than have a separate timer or thread to do this, it would be easier to have this done whenever a user creates a URL.
You will need to write a function in order to execute a simple query on the database which checks to see if the created timestamp for all entries is 30 days old or older, and deletes entries where that is true.
If the /report endpoint is also created by the time this issue is claimed, please also have your function called when a URL is reported. Please make sure that you pass in the SQL cursor from the parent function, as it is more efficient to reuse the same database cursor since the action occurs in the same thread.
I would like URLs to expire after 30 days. However, rather than have a separate timer or thread to do this, it would be easier to have this done whenever a user creates a URL.
You will need to write a function in order to execute a simple query on the database which checks to see if the
created
timestamp for all entries is 30 days old or older, and deletes entries where that is true.You will need to use a SQL
delete
statement with awhere
clause. Please see https://www.w3schools.com/sql/sql_delete.aspIf the
/report
endpoint is also created by the time this issue is claimed, please also have your function called when a URL is reported. Please make sure that you pass in the SQL cursor from the parent function, as it is more efficient to reuse the same database cursor since the action occurs in the same thread.