Skip to content

Commit

Permalink
#2305 Migration refacto
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 22, 2022
1 parent 6d81903 commit 1a76c00
Show file tree
Hide file tree
Showing 7 changed files with 373 additions and 271 deletions.
2 changes: 1 addition & 1 deletion ScalliGraph
4 changes: 2 additions & 2 deletions migration/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ output {
}
}

threadCount: 3
transactionPageSize: 100
threadCount: 4
transactionPageSize: 50

from {
db {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scopt.OParser
import java.io.File
import java.nio.file.{Files, Paths}
import scala.collection.JavaConverters._
import scala.concurrent.duration.{Duration, DurationInt}
import scala.concurrent.duration.DurationInt
import scala.concurrent.{blocking, Await, ExecutionContext, Future}

object Migrate extends App with MigrationOps {
Expand Down Expand Up @@ -56,7 +56,7 @@ object Migrate extends App with MigrationOps {
opt[Unit]('d', "drop-database")
.action((_, c) => addConfig(c, "output.dropDatabase", true))
.text("Drop TheHive4 database before migration"),
opt[Boolean]('r', "resume")
opt[Unit]('r', "resume")
.action((_, c) => addConfig(c, "output.resume", true))
.text("Resume migration (or migrate on existing database)"),
opt[String]('m', "main-organisation")
Expand Down Expand Up @@ -224,8 +224,7 @@ object Migrate extends App with MigrationOps {
val output = th4.Output(Configuration(config.getConfig("output").withFallback(config)))
val filter = Filter.fromConfig(config.getConfig("input.filter"))

val process = migrate(input, output, filter)
blocking(Await.result(process, Duration.Inf))
migrate(input, output, filter).get
logger.info("Migration finished")
0
} catch {
Expand Down
Loading

0 comments on commit 1a76c00

Please sign in to comment.