You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Short code generator is created as an Iterator that starts from aaaaaaaa and goes on.
It does not remember where it left off on an application restart. Got to fix this.
The text was updated successfully, but these errors were encountered:
Potential approaches below. Let's review and identify one:
Add an entry for the next indices and length of sequence in DB to restore on restart.
Add a column for time ticks(elapsed since epoc) in the URL table in postgre. On restart, obtain the latest URL inserted based on the time ticks. Identify current indices based on the short url in the record. generate next url based on current short url.
Edit: Looking at "#3", it appears neither of the options will work. Instead we completely randomize the sequence and check against the URL repository to check if the sequence has been consumed.
We need to find a way to return sequences in a random order.
How about pre-generating say 10 million sequences and return them randomly? the next 10 million can be generated when needed and randomize them. we could potentially do this in a separate thread pool.
Need a simple mechanism.
Short code generator is created as an Iterator that starts from aaaaaaaa and goes on.
It does not remember where it left off on an application restart. Got to fix this.
The text was updated successfully, but these errors were encountered: