New thread for SQL

Discussion in 'Plugin Development' started by Nogtail, Jan 6, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Nogtail

    You often see people using SQL in a separate thread so that queries that take longer can be executed without lagging the server but if I want for example check if a player is banned, or what rank he is when logging in I can't really do that in another thread as I need to know that instant if he should be kicked or what colour to make his name but I can't think of a soulution.
     
  2. Nogtail Well, does it matter if he gets kicked immediately or after 2 ticks? It doesn't. Nor does it matter that much anywhere else. If it takes a second or so then what? Nothing bad will happen and if it takes a bit for people to get their permissions/rights or whatever on join, then it's nothing problematic either.
     
  3. Offline

    LucasEmanuel

    In order to use the bukkit API from a separate thread you can schedule a sync task that does what you want.

    EDIT:
    Or, if you want something directly, store the data in ram and access that data whenever you need to, then have a repeating async task that saves/loads all of your buffered data in to the database.
     
  4. Offline

    Nogtail

    It would be a pain if a user repeatedly joined and spammed a message before being kicked and for chat related uses if the result is not cached the user would experience delay when sending messages.

    That would work quite well but for larger servers where there tens or hundreds of thousands of player files it would not work so well.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  5. Nogtail easy fix: only allow people to talk where that query has been run already.
     
  6. Offline

    LucasEmanuel

    Then block the user you want to look up from doing anything until the check has been completed. :)
     
Thread Status:
Not open for further replies.

Share This Page