-
Notifications
You must be signed in to change notification settings - Fork 28
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
Expiry for Links #22
Comments
I would like to work on this issue. |
Go for it !!! |
Is this issue solved? @ChakshuGautam |
Not really. Do you want to pick this up? |
Yeah. I needed some more details regarding the exact requirement. |
Can you share an approach how you want to implement this? |
Actually, I haven't got a clear idea about what exactly is needed to be done |
The project is a URL shortener that stores link indefinitely. For some campaigns, the users don't need the link to work indefinitely. It should show "link expired" after expiry. |
Can you list some of the campaigns if possible? |
It's a simple model right now. You can see the schema here -
We need a new field called |
As per my understanding, |
Yes, this is it. Optionally we can have a custom 410 page as well that can come up. That would be a delight functionality. You can pick a design. |
Okay. Thanks for helping me out and solving my queries. I will work on this and create a pr soon. |
I had a doubt @ChakshuGautam where should the checking function be implemented? In the same file? Also, where can I create the 404 page? Can you please specify the location for that too |
Could you please answer my above question? @ChakshuGautam |
Can you share your progress till now? What have you tried, what worked what didn't? If you already have an opinion on this can you share that as well? |
I have added a new field called status which is an enum with the values mentioned and an expiry field that will hold the expiry date of a link. For the function where the system needs to check when the current date is more than expiry and stop resolving the short link to the long link and send a 410, I am unable to understand where should I like the logic for it and also where should I create the design for the 410 page |
You might want to change this place - yaus/apps/api/src/app/app.controller.ts Line 102 in 26eb452
|
Thank you. I will work on this and create a pr soon. |
Is this issue resolved sir @ChakshuGautam ? |
Not yet. Please go ahead and raise a PR. |
Okay , as soon as I finish this, I'll raise a PR. |
Hi @ChakshuGautam, is the issue resolved? I would like to work on this issue. |
Not yet @Palaksharma23. This is still open. |
I have been thinking about Possible solution to manage expired links and here is a crisp summary of possible solution after discussing with @yuvrajsab
|
hey @Nazi-pikachu, I think there is one more possible solution to this problem; we can leverage Redis here. we can add a Redis layer on top of Postgres. when a user creates a new link it will get added to the Redis with an expiry. so that the link will get automatically popped out of the cache and will not be available anymore. And we can create a cronjob that will sync the Postgres with the Redis (meaning disable/delete the links which are not present in the cache). But you'll need to handle all the edge cases properly. lemme know what you think about this. |
Hey @yuvrajsab |
@Nazi-pikachu, I too think this is the best idea out of all we considered. You can identify all the places where we can involve cache and it could be possible that we could lose cache data(or key) unexpectedly; for that, we need to keep the cache synced with db meaning delete from the cache if something is deleted from db or add to the cache if something is added to the db. Remember all the side-effects should be done through RabbitMQ. As of now, I'm not seeing any drawback to this approach You can start implementing this👍. |
Hey @yuvrajsab |
Is your feature request related to a problem? Please describe.
Currently the links are persisted indefinitely. We should remove redirection and allow hashes to get reused once the link expires.
Describe the solution you'd like
A link should have the following states
draft
- no hash assignedlive
expired
- hash can be repurposedThe text was updated successfully, but these errors were encountered: