Samagra-Development / yaus

Yet Another URL Shortner
https://github.com/Samagra-Development/yaus/wiki
11 stars 28 forks source link

Feat : Link Expiry Management #79

Closed Nazi-pikachu closed 1 year ago

Nazi-pikachu commented 1 year ago

Description

This draft pull request introduces the link expiry feature, allowing links to automatically expire after a specified period. The implementation includes the necessary backend changes, database schema modifications, and frontend updates.

Related Issue

22

52

Proposed Changes

Relavant ScreenShots

image

Checklist

Additional Notes

By default the value of state is Draft and the expiry date can be null to indicate that ther is no expiration date set by the user.

Nazi-pikachu commented 1 year ago

https://github.com/Samagra-Development/yaus/assets/63303757/716a2ce4-6758-46b8-9200-c233ef840cae

Hey @yuvrajsab This is a the draft implementation of link-expiry. In redirect service we are already fetching the params and since we need to add state and expiry as params filed we can utilize it to check the expiration date. There are few drawback of this approach

  1. One is that it makes no difference to the user that whether the link has expired or the link is not found.
  2. Removal of Expired link : I am thinking of tackling this using a cron job

    Changes this will cause:

    By using performance hooks (perf_hooks) i can notice an increase of 1ms in response time.

S.NO After(ms) Before(ms)
1 2.484800041 0.2505000234
2 0.6238999963 0.07190001011
3 1.095600009 0.06980001926
4 0.771600008 0.1779000163
5 0.796399951 0.07929998636
     
AVG 1.154460001 0.1298800111
     
DIFF 1.02457999 ms