Skip to content

Commit

Permalink
Fix #13 MySQLExtractor: Reconnect after some time on connection failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocdaothanh committed Apr 7, 2015
1 parent 21e422b commit 006d66a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.6:

* [#13](https://github.com/ngocdaothanh/mydit/issues/13)
MySQLExtractor: Reconnect after some time on connection failure

1.5:

* [#12](https://github.com/ngocdaothanh/mydit/issues/12)
Expand Down
5 changes: 4 additions & 1 deletion src/main/scala/mydit/MySQLExtractor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ class MySQLExtractor(
if (delaySecs > 0) Thread.sleep(delaySecs * 1000)
client.connect()
} catch {
case NonFatal(e) => Log.error("Error", e)
case NonFatal(e) =>
val delay = if (delaySecs > 0) delaySecs else RECONNECT_DELAY_SECS
Log.error(s"Could not connect, will reconnect in $delay seconds", e)
connectInNewThread(delay)
}
}
}.start()
Expand Down

0 comments on commit 006d66a

Please sign in to comment.