mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
corrected scheduler bug
This commit is contained in:
@@ -73,19 +73,22 @@ func loadActionTimings(storage timespans.StorageGetter) {
|
||||
sched.queue = timespans.ActionTimingPriotityList{}
|
||||
for key, ats := range actionTimings {
|
||||
toBeSaved := false
|
||||
for i, at := range ats {
|
||||
toBeSaved = toBeSaved || at.CheckForASAP()
|
||||
isAsap := false
|
||||
newAts := make([]*timespans.ActionTiming, 0)
|
||||
for _, at := range ats {
|
||||
isAsap = at.CheckForASAP()
|
||||
toBeSaved = toBeSaved || isAsap
|
||||
if at.IsOneTimeRun() {
|
||||
timespans.Logger.Info(fmt.Sprintf("Time for one time action on %v", at))
|
||||
go at.Execute()
|
||||
// remove it from list
|
||||
ats = append(ats[:i], ats[i+1:]...)
|
||||
// do not append it to the newAts list to be saved
|
||||
} else {
|
||||
sched.queue = append(sched.queue, at)
|
||||
newAts = append(newAts, at)
|
||||
}
|
||||
}
|
||||
if toBeSaved {
|
||||
storage.SetActionTimings(key, ats)
|
||||
storage.SetActionTimings(key, newAts)
|
||||
}
|
||||
}
|
||||
sort.Sort(sched.queue)
|
||||
|
||||
@@ -17,18 +17,9 @@
|
||||
[global]
|
||||
redis_server = 127.0.0.1:6379 #redis address host:port
|
||||
redis_db = 10 # redis database number
|
||||
logdb_type = postgres #
|
||||
logdb_type = mongo #
|
||||
logdb_host = localhost # The host to connect to. Values that start with / are for UNIX domain sockets.
|
||||
logdb_port = 5432 # The port to bind to.
|
||||
logdb_name = gosqltest # The name of the database to connect to.
|
||||
logdb_user = rif # The user to sign in as.
|
||||
logdb_passwd = testus # The user's password.root
|
||||
|
||||
[rater]
|
||||
enabled = true
|
||||
listen = 127.0.0.1:2001 # listening address host:port, internal for internal communication only
|
||||
balancer = disabled # if defined it will register to balancer as worker
|
||||
rpc_encoding = gob # use JSON for RPC encoding
|
||||
logdb_name = cgrates # The name of the database to connect to.
|
||||
|
||||
[scheduler]
|
||||
enabled = true
|
||||
|
||||
Reference in New Issue
Block a user