Hi,
I am trying to watch a config file for modifications with the following piece of code:
object WatchTest extends App {
implicit val system: ActorSystem = ActorSystem("mySystem")
val watcher: ActorRef = File(conf_dir + "/application.conf").newWatcher(recursive = false)
watcher ! on(EventType.ENTRY_MODIFY) { file =>
println(s"$file got modified")
}
}
I could watch a single file instead of a directory, right?
This seems to work but the problem is that everytime I am modififying the file, more than one events are getting generated. This is problematic since the sideeffects in the callback can't be called more than once.
Please suggest how can I achieve this or if I am doing something wrong?
Hi,
I am trying to watch a config file for modifications with the following piece of code:
I could watch a single file instead of a directory, right?
This seems to work but the problem is that everytime I am modififying the file, more than one events are getting generated. This is problematic since the sideeffects in the callback can't be called more than once.
Please suggest how can I achieve this or if I am doing something wrong?