mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Update behaviour of file readers using inotify
Ensure that files already existing in the source path are processed before the reader starts listening for filesystem change events.
This commit is contained in:
committed by
Dan Christian Bogos
parent
a362511d7a
commit
5c1e128f4f
@@ -97,6 +97,11 @@ func (rdr *CSVFileER) Serve() (err error) {
|
||||
case time.Duration(0): // 0 disables the automatic read, maybe done per API
|
||||
return
|
||||
case time.Duration(-1):
|
||||
|
||||
// Ensure that files already existing in the source path are processed
|
||||
// before the reader starts listening for filesystem change events.
|
||||
processReaderDir(rdr.sourceDir, utils.CSVSuffix, rdr.processFile)
|
||||
|
||||
return utils.WatchDir(rdr.sourceDir, rdr.processFile,
|
||||
utils.ERs, rdr.rdrExit)
|
||||
default:
|
||||
|
||||
@@ -106,6 +106,11 @@ func (rdr *FWVFileER) Serve() (err error) {
|
||||
case time.Duration(0): // 0 disables the automatic read, maybe done per API
|
||||
return
|
||||
case time.Duration(-1):
|
||||
|
||||
// Ensure that files already existing in the source path are processed
|
||||
// before the reader starts listening for filesystem change events.
|
||||
processReaderDir(rdr.sourceDir, utils.FWVSuffix, rdr.processFile)
|
||||
|
||||
return utils.WatchDir(rdr.sourceDir, rdr.processFile,
|
||||
utils.ERs, rdr.rdrExit)
|
||||
default:
|
||||
|
||||
@@ -100,6 +100,11 @@ func (rdr *JSONFileER) Serve() (err error) {
|
||||
case time.Duration(0): // 0 disables the automatic read, maybe done per API
|
||||
return
|
||||
case time.Duration(-1):
|
||||
|
||||
// Ensure that files already existing in the source path are processed
|
||||
// before the reader starts listening for filesystem change events.
|
||||
processReaderDir(rdr.sourceDir, utils.JSNSuffix, rdr.processFile)
|
||||
|
||||
return utils.WatchDir(rdr.sourceDir, rdr.processFile,
|
||||
utils.ERs, rdr.rdrExit)
|
||||
default:
|
||||
|
||||
@@ -82,6 +82,11 @@ func (rdr *XMLFileER) Serve() (err error) {
|
||||
case time.Duration(0): // 0 disables the automatic read, maybe done per API
|
||||
return
|
||||
case time.Duration(-1):
|
||||
|
||||
// Ensure that files already existing in the source path are processed
|
||||
// before the reader starts listening for filesystem change events.
|
||||
processReaderDir(rdr.sourceDir, utils.XMLSuffix, rdr.processFile)
|
||||
|
||||
return utils.WatchDir(rdr.sourceDir, rdr.processFile,
|
||||
utils.ERs, rdr.rdrExit)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user