Defect/Bug #94
Updated by Slind over 9 years ago
The claim loading time on B-Team is extremely high. We should either look for an automated cleanup of claims from players that didn't spent much time or high improve the performance of the loading process.
Comparison:
<pre>
B-Tema 1 (flat file)
loading time 6m 32s
claim data 6.421
player data 34.694
B-Team 2 (flat file)
loading time 6m 4s
claim data 7.571
player data 28.947
B-Team 3 (mysql)
loading time 35s
claim data 2.388
player data 7.374
</pre>
Script for flat file to db migration (not needed but at least 10 times faster than grief prevention's, but it is ignoring parent ships and non builder trust's, which are barely used) - _created as grief prevention didn't want to convert in the first place_
<pre>
#!/usr/bin/python
import MySQLdb
import os
db = MySQLdb.connect("localhost","user","password","database")
cursor = db.cursor()
for fn in os.listdir('./plugins/GriefPrevention/ClaimData'):
claim_id = fn
claim_data = open('./plugins/GriefPrevention/ClaimData/' + fn, 'r')
lines = claim_data.readlines()
claim_data.close()
if len(lines) > 4:
claim_lessercorner = lines[0]
claim_greatercorner = lines[1]
claim_owner = lines[2]
claim_builders = lines[3]
cursor.execute("""INSERT INTO griefprevention_claimdata (id, owner, lessercorner, greatercorner, builders, containers, accessors, managers, parentid, neverdelete)
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (claim_id, claim_owner, claim_lessercorner, claim_greatercorner, claim_builders, "", "", "", -1, 0))
db.commit()
print (claim_owner)
for pn in os.listdir('./plugins/GriefPrevention/PlayerData'):
player_name = pn
player_data = open('./plugins/GriefPrevention/PlayerData/' + pn, 'r')
lines = player_data.readlines()
player_data.close()
if len(lines) > 4:
player_lastlogin = lines[0]
player_accruedblocks = lines[1]
player_bonusblocks = lines[2]
cursor.execute("""INSERT INTO griefprevention_playerdata (name, lastlogin, accruedblocks, bonusblocks, clearonjoin)
VALUES(%s, %s, %s, %s, %s)""", (player_name, player_lastlogin, player_accruedblocks, player_bonusblocks, 0))
db.commit()
print (player_lastlogin)
db.close()
</pre>