Post queue too big (crashing site)

Unsolved Technical Support
  • Hi all,

    v1.17.2 with mongodb

    One of our forums gets a lot of spam. We have enabled Post queue to only approve the posts that are non spam manually. We are now in a situation where that queue is so big that when ever I access the /post-queue url. It crashes the forum.

    I tried to find a way to manage this via mongo cli by removing all posts through database. e.g any post that has an external url is most likely spam. Unfortunately https://docs.nodebb.org/development/database-structure/ doesn't point out the the exact structure I would utilise to write above kind of query.

    I couldn't find a api endpoint to manage this programmatically too.

    All i need is to get the list of posts in the queue with their body message and pointer on what relevant documents to delete to remove the notification from the post queue and post.

    @Staff any help would be appreciated.

  • I will post a couple queries to help with this.

    Get number of queued posts

    db.objects.count({_key: "post:queue"});
    

    Get latest 20 post queue objects ids

    db.objects.find({_key: "post:queue"}).sort({score: -1}).limit(20);
    

    Using ids from above query you can get the queued posts with

    db.objects.find({_key: "post:queue:<replace_with_id_from_above_query"});
    

    To delete a post queue from the db with id 123456

    db.objects.remove({_key: "post:queue", value: "123456"});
    db.objects.remove({_key: "post:queue:123456"});
    

    To remove all queued posts

    db.objects.remove({_key: /^post:queue/});
    

    Hope that helps.


Suggested Topics