Skip to content

Commit

Permalink
Boosted performance of run command for smaller data sets
Browse files Browse the repository at this point in the history
We were spending upto 50s loading data from the database; the run command now works on a far lazier, on-demand basis.
  • Loading branch information
kfsone committed Nov 17, 2014
1 parent 9d93ee4 commit 9373c00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,8 @@ def validateRunArguments(tdb, cmdenv):
raise NoDataError("End station {} doesn't have any price data.".format(
stopStn.name()))

tdb.loadTrades()

if startStn:
tdb.loadStationTrades([startStn.ID])
if stopStn and cmdenv.hops == 1 and not stopStn in startStn.tradingWith:
raise CommandLineError("No profitable items found between {} and {}".format(
startStn.name(), stopStn.name()))
Expand All @@ -311,6 +310,7 @@ def run(results, cmdenv, tdb):
raise NoDataError("Database does not contain any profitable trades.")

validateRunArguments(tdb, cmdenv)
tdb.buildLinks()

from tradecalc import TradeCalc, Route

Expand Down

0 comments on commit 9373c00

Please sign in to comment.