-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Mass Bans? #23
Comments
Interesting use case @irazasyed! I haven't thought about it before. Here is how it works:
|
There is a way to remove 2nd query if we'll remove updating of the But then we'll lose ability to auto-ban model on ban model creation: $ban = $user->bans()->create([
'comment' => 'Enjoy your ban',
'expired_at' => '+1 month',
]); Then we will be able to introduce By this way for 100 bans we'll have 100 queries with bans creations and 1 more with updating timed flags. |
There is one more possible solution. We'll lose ability to auto-ban model on ban model creation too. Remove By this way for 100 bans we'll have 100 queries with bans creations, 100 queued jobs and 100 more queries in those queues with updating |
That sounds like a lot of processing and work using Queues and all. Can't we just use Anyone listening to that event can simply check if it's a collection or a single Bannable model, etc. (whatever is being passed -- I haven't checked in-depth). I'll explore and play around with this and see if I can figure something out. |
I'm not sure it's good to fire event with all banned models as collection, because it will be harder to make users to listen only their own models events. |
So I just setup a job to ban many users and while it does the job fine but I'm now facing another issue due to the observer as I'm banning the users over an API that's stateless and because of the way the observer is implemented, it now won't fill the I think you should make these two values fillable and let me pass the I think we need to look into this to also optimize the number of queries somehow. Perhaps, Your first solution is good enough unless you have alternate ideas you thought of over the past month or so! |
@irazasyed I agree that Observers usage should be revised. This feature is sweet, but I've started to face many issues with applications which using them a lot. |
@antonkomarev So until that is revised and or we come up with some solution, Can you at least add those two columns to the fillables array? That would be great for the time being and would be very helpful. |
@irazasyed made |
Thank you so much @antonkomarev. Appreciated :) |
What's the most efficient way to handle mass bans?
Right now looping through all bannable models and then applying the ban is making 3 queries each (So if I was to ban say 1k users, that's 3k queries and isn't good TBH). So if I was to do mass ban, then it's not really efficient.
So I wanna know if there's a better way to achieve this?
The text was updated successfully, but these errors were encountered: