Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
docs(diff): add some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 7, 2022
1 parent 6decf6d commit 656a33e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DiffRepository(val systemId: String, val language: String, val since: Stri
values["package_name"] = changedCall.packageName
values["relations"] = Json.encodeToString(changedCall.relations)

batch.add("scm_diff_changes", values)
batch.add("scm_diff_change", values)
}

private fun flush() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ class Runner : CliktCommand() {
private val systemId: String by option(help = "system id").default("0")
private val language: String by option(help = "language").default("")


// todo: add multiple languages support
override fun run() {
// todo: add multiple languages support
logger.info("diff from $since to $until on branch: $branch ")

val differ = GitDiffer(path, branch)
val changedCalls = differ.countBetween(since, until)

logger.info("found changes: ${changedCalls.size}")
logger.info("start insert data into Mysql")
val sqlStart = System.currentTimeMillis()

Expand All @@ -46,17 +50,14 @@ class Runner : CliktCommand() {
private fun storeDatabase(systemId: String) {
store.disableForeignCheck()
store.initConnectionPool()
val tableName = "diff_change"

val tableName = "scm_diff_change"
logger.info("--------------------------------------------------------")
val phaser = Phaser(1)
deleteByTable(tableName, phaser, systemId)

phaser.arriveAndAwaitAdvance()
logger.info("------------ system {} clean db is done --------------", systemId)
saveByTables(arrayOf(tableName), phaser)
phaser.arriveAndAwaitAdvance()

logger.info("------------ system {} update db is done --------------", systemId)
logger.info("--------------------------------------------------------")
store.enableForeignCheck()
Expand Down

0 comments on commit 656a33e

Please sign in to comment.