-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
[BUG] BETA V4 - Tickets ID duplicating #418
Comments
@eartharoid maybe use uuids for tickets and remove the ticket number completely |
Or just queue up requests so the bot responds to them one at a time, Discords API latency which is fairly high in comparison to the bots latency means that the bot could spend an extra bit doing that and the average user likely won't notice |
Tickets already have a unique ID as the primary key, it's the channel ID. The number is a secondary more user-friendly ID.
As far as I can tell, it's impossible to use
I thought of this too. It could be possible to create a queue for each guild but I'm not sure how to do that, especially in a way that doesn't negatively impact performance more than necessary. It would need only to affect the I also thought about transactions/locking, but this would need to block all reads and writes on the There's also OCC, but I don't see how that can work in this situation. I think a simpler solution is possible: bot/src/lib/tickets/manager.js Line 376 in cf93f08
bot/src/lib/tickets/manager.js Line 640 in cf93f08
There are currently over 250 lines between reading and writing with several INSERT INTO tickets (
number
)
VALUES (
SELECT number FROM (SELECT MAX(number) + 1 AS number FROM tickets WHERE guildId = '$guildId') AS T
);
This should work, but I don't think it's possible in Prisma without using Alternatively, just catch the error and retry, although that's not very elegant as the channel name will be wrong. |
my 30 second reply: either you remove it completely or you try to fix it which will cause performance issues |
Loading and storing the ticket count for each guild at startup like member and category counts is a good option. |
Now there is a change that a number will be skipped (if there's an error), but that isn't a problem.
Is there an existing issue for this?
Current Behavior
If users create many tickets at one time, tickets are created with the same ID, and only one ticket can work (other tickets give errors during any interactions).
Expected Behavior
Tickets IDs should not be duplicated.
Steps To Reproduce
Environment
Anything else?
Logs:
Interaction on "bad" ticket:
The text was updated successfully, but these errors were encountered: