Open shah-anurag opened 3 years ago
Upon thinking more on this, I feel it is the right behavior. We can have KGS remove the key from RemainingKeys collection and return that to appServer which can write the keys to UsedKeys collection after it was successfully able to store in the URL collection but that would affect the logic of KeyDb as it can potentially generate the same key and reenter it in the RemainingKeys collection meanwhile. With present architecture in worst case scenario we would loose some keys as they would be wrongly marked as Used but that's ok as we have a lot of keys
This issue occurs even when already registered longURL is used for registering again. This is a red flag as this can get exploited easily which can potentially cause keydb to use up all the shortUrlIds without even actually registering a single longURL
When Application Server fails to register a long URL, KeyDb still registers the shortUrlId in the UsedKey collection. Fix it