Solved How to achieve best performance?

Discussion in 'Plugin Development' started by Tim_M, Oct 30, 2021.

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

    Tim_M

    I'm making plugin where people can claim chunks, but if they don't login for one amount of days the chunk will unclaim itself. I currently have a map of chunks and calendars (the calendar is when it's calculated to expire). The question is, what's the best way to remove the chunks? With potentially thousands of people claiming multiple chunks scheduling a task for each one seems very slow. What's the best way?
     
  2. Offline

    Kars

    How many thousands of people are you expecting to claim chunks? I suspect you are perhaps greatly overestimating the amount your plugin will get used.

    Anyway. Just have a map with a date/calendar and a collection of chunks. This way you can claim multiple chunks in the same moment. Then schedule a task every hour that removes all entries if their expiration date is exceeded.
    Not performance intensive at all.
     
  3. Offline

    timtower Administrator Administrator Moderator

    Can even have it scheduled to the first one that needs removal, then just have a delay till the next one.
     
  4. Offline

    Tim_M

    alr, thanks
     
Thread Status:
Not open for further replies.

Share This Page