Commit 087f9d30 authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Moved SQL related imports to the relevant function from object level

parent f3577ac8
......@@ -19,11 +19,6 @@ import scala.concurrent.duration.Duration
*/
@Singleton
class DataPersister @Inject() (private val dbConfigProvider: DatabaseConfigProvider, private val sget2: SGet2) extends UntypedActor {
private val dbConfig = dbConfigProvider.get[JdbcProfile]
import dbConfig.driver.api._
private val jobs = TableQuery[JobsTable]
private val chunks = TableQuery[ChunksTable]
private val queue = TableQuery[QueueTable]
@volatile
private var saveRequested: Boolean = false
......@@ -78,6 +73,12 @@ class DataPersister @Inject() (private val dbConfigProvider: DatabaseConfigProvi
/* Persists the queue data to DB asynchronously */
private def persist(event: PersistEvent): Unit = {
val dbConfig = dbConfigProvider.get[JdbcProfile]
import dbConfig.driver.api._
val jobs = TableQuery[JobsTable]
val chunks = TableQuery[ChunksTable]
val queue = TableQuery[QueueTable]
/* Iterate through the download queue */
for (d sget2.downloadQueue.persist().jobList) {
/* Update queue table */
......
......@@ -33,4 +33,5 @@ class SGet2Startup @Inject() (private val sget2: SGet2, val lifecycle: Applicati
res
sget2.downloadQueue.start()
}
// We don't care when the resulting future redeems, we continue startup and the thread will complete eventually.
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment