mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
updated fsnotify to the new location and latest version
This commit is contained in:
10
cdrc/cdrc.go
10
cdrc/cdrc.go
@@ -33,7 +33,7 @@ import (
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/howeyc/fsnotify"
|
||||
"gopkg.in/fsnotify.v1"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -169,7 +169,7 @@ func (self *Cdrc) trackCDRFiles() (err error) {
|
||||
return
|
||||
}
|
||||
defer watcher.Close()
|
||||
err = watcher.Watch(self.cdrInDir)
|
||||
err = watcher.Add(self.cdrInDir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -180,15 +180,15 @@ func (self *Cdrc) trackCDRFiles() (err error) {
|
||||
self.exitChan <- exitChan
|
||||
engine.Logger.Info(fmt.Sprintf("<Cdrc> Shutting down CDRC on path %s.", self.cdrInDir))
|
||||
return nil
|
||||
case ev := <-watcher.Event:
|
||||
if ev.IsCreate() && (self.CdrFormat != FS_CSV || path.Ext(ev.Name) != ".csv") {
|
||||
case ev := <-watcher.Events:
|
||||
if ev.Op&fsnotify.Create == fsnotify.Create && (self.CdrFormat != FS_CSV || path.Ext(ev.Name) != ".csv") {
|
||||
go func() { //Enable async processing here
|
||||
if err = self.processFile(ev.Name); err != nil {
|
||||
engine.Logger.Err(fmt.Sprintf("Processing file %s, error: %s", ev.Name, err.Error()))
|
||||
}
|
||||
}()
|
||||
}
|
||||
case err := <-watcher.Error:
|
||||
case err := <-watcher.Errors:
|
||||
engine.Logger.Err(fmt.Sprintf("Inotify error: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
import os
|
||||
import os.path
|
||||
from subprocess import call
|
||||
|
||||
libs = ('github.com/lib/pq',
|
||||
'github.com/ugorji/go/codec',
|
||||
'gopkg.in/mgo.v2',
|
||||
'github.com/cgrates/fsock',
|
||||
'github.com/cgrates/liner',
|
||||
'github.com/cgrates/kamevapi',
|
||||
'github.com/go-sql-driver/mysql',
|
||||
'github.com/hoisie/redis'
|
||||
'github.com/howeyc/fsnotify',
|
||||
'github.com/cgrates/gorm',
|
||||
'github.com/gorhill/cronexpr',
|
||||
"github.com/DisposaBoy/JsonConfigReader"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
go_path = os.path.join(os.environ['GOPATH'], 'src')
|
||||
for lib in libs:
|
||||
app_dir = os.path.abspath(os.path.join(go_path,lib))
|
||||
|
||||
if os.path.islink(app_dir): continue
|
||||
git_path = os.path.join(app_dir, '.git')
|
||||
bzr_path = os.path.join(app_dir, '.bzr')
|
||||
hg_path = os.path.join(app_dir, '.hg')
|
||||
svn_path = os.path.join(app_dir, '.svn')
|
||||
if os.path.lexists(svn_path):
|
||||
print("Updating svn %s" % app_dir)
|
||||
os.chdir(app_dir)
|
||||
call(['svn', 'update'])
|
||||
elif os.path.lexists(git_path):
|
||||
print("Updating git %s" % app_dir)
|
||||
os.chdir(app_dir)
|
||||
call(['git', 'checkout', 'master'])
|
||||
call(['git', 'pull'])
|
||||
elif os.path.lexists(bzr_path):
|
||||
print("Updating bzr %s" % app_dir)
|
||||
os.chdir(app_dir)
|
||||
call(['bzr', 'pull'])
|
||||
elif os.path.lexists(hg_path):
|
||||
print("Updating hg %s" % app_dir)
|
||||
os.chdir(app_dir)
|
||||
call(['hg', 'pull', '-uv'])
|
||||
else:
|
||||
continue
|
||||
call(['go', 'install'])
|
||||
@@ -12,7 +12,7 @@ go get -v -u github.com/ugorji/go/codec
|
||||
go get -v -u gopkg.in/mgo.v2
|
||||
go get -u -v github.com/go-sql-driver/mysql
|
||||
go get -u -v github.com/hoisie/redis
|
||||
go get -u -v github.com/howeyc/fsnotify
|
||||
go get -u -v gopkg.in/fsnotify.v1
|
||||
go get -u -v github.com/gorhill/cronexpr
|
||||
go get -u -v github.com/DisposaBoy/JsonConfigReader
|
||||
go get -u -v golang.org/x/net/websocket
|
||||
|
||||
Reference in New Issue
Block a user