Skip to content

Commit

Permalink
Fix #8 Cannot exit when the number of errors exceeds the configured t…
Browse files Browse the repository at this point in the history
…hreshold
  • Loading branch information
ngocdaothanh committed Mar 26, 2015
1 parent be61aa8 commit 51b8b33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Optimize: Don't get column info again when not needed
* [#5](https://github.com/ngocdaothanh/mydit/issues/5)
Convert MySQL text to MongoDB UTF-8 String
* [#8](https://github.com/ngocdaothanh/mydit/issues/8)
Fix bug: Cannot exit when the number of errors exceeds the configured threshold
* [#6](https://github.com/ngocdaothanh/mydit/issues/6)
Update Logback from 1.1.2 to 1.1.3
* [#7](https://github.com/ngocdaothanh/mydit/issues/7)
Expand Down
6 changes: 5 additions & 1 deletion src/main/scala/mydit/MySQLExtractor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ class MySQLExtractor(
}
}

def start() {
def connect() {
client.connect()
}

def disconnect() {
client.disconnect()
}

//--------------------------------------------------------------------------

private def onFormatDescription(data: FormatDescriptionEventData) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/scala/mydit/Rep.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Rep(config: Config) extends RepEvent.Listener {
mo.binlogGetPosition
)
my.addListener(this)
my.start()
my.connect()

//--------------------------------------------------------------------------

Expand Down Expand Up @@ -59,6 +59,10 @@ class Rep(config: Config) extends RepEvent.Listener {
"Replicator program now exits because the failed replication event queue size exceeds {} (see config/application.conf)",
config.maxFailedEventQueueSize
)

// Need to disconnect before exiting, otherwise we can't exit because
// there are still running threads
my.disconnect()
System.exit(-1)
}
} else if (lastQSize > 0) {
Expand Down

0 comments on commit 51b8b33

Please sign in to comment.