Mod run.py/config.py/prefetch.py for apsw

This commit is contained in:
HomeWorld
2010-10-15 22:44:15 +03:00
parent 779a5ad652
commit 8cb1221174
3 changed files with 35 additions and 11 deletions

View File

@@ -13,7 +13,9 @@ else:
homePath = os.path.expanduser(os.path.join("~", ".pyfa"))
staticPath = homePath
saveddata = os.path.join(homePath, "saveddata.db")
gamedata = os.path.join(homePath, "eve.db")
# saveddata db location modifier, shouldn't ever need to touch this
import eos.config
eos.config.saveddata_connectionstring = "sqlite:///" + saveddata
eos.config.saveddata_connectionstring = "sqlite:///" + gamedata

20
run.py
View File

@@ -19,6 +19,26 @@
#===============================================================================
import config
import apsw
mem = apsw.Connection(":memory:")
disk = apsw.Connection(config.gamedata)
b = mem.backup("main", disk, "main")
try:
while not b.done:
b.step()
finally:
b.finish()
print config.gamedata
print b.done
import eos.config
import sqlite3
conn = sqlite3.connect(mem)
eos.config.gamedata_connectionstring = lambda: conn
#print "failed to use apsw to copy gamedata to memory, continueing, but a bit slower"
from gui.mainFrame import MainFrame
import wx
import os

View File

@@ -20,20 +20,22 @@
import threading
import service
import eos.db
import time
class PrefetchThread(threading.Thread):
def run(self):
# We're a daemon thread, as such, interpreter might get shut down while we do stuff
# Make sure we don't throw tracebacks to console
try:
eos.db.getItemsByCategory("Skill", eager=("effects", "attributes", "attributes.info.icon", "icon"))
cMarket = service.Market.getInstance()
root = cMarket.getShipRoot()
for id, _ in root:
cMarket.getShipList(id)
except:
return
print "Prefetch started"
time.clock()
prefetch = PrefetchThread()
prefetch.daemon = True
prefetch.start()
eos.db.getItemsByCategory("Skill", eager=("effects", "attributes", "attributes.info.icon", "icon"))
cMarket = service.Market.getInstance()
root = cMarket.getShipRoot()
for id, _ in root:
cMarket.getShipList(id)
print "Prefetch stopped", time.clock()
#prefetch = PrefetchThread()
#prefetch.daemon = True
#prefetch.start()