better load & peear cache for traefik
This commit is contained in:
parent
241c6a5a08
commit
b4a1766677
@ -52,7 +52,7 @@ func (a *bookingMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int
|
|||||||
func (a *bookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
func (a *bookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||||
return utils.GenericLoadOne[*Booking](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
return utils.GenericLoadOne[*Booking](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
now = now.Add(time.Second * 60)
|
now = now.Add(time.Second * -60)
|
||||||
if d.(*Booking).State == enum.DRAFT && now.UTC().After(d.(*Booking).ExpectedStartDate) {
|
if d.(*Booking).State == enum.DRAFT && now.UTC().After(d.(*Booking).ExpectedStartDate) {
|
||||||
return utils.GenericDeleteOne(d.GetID(), a)
|
return utils.GenericDeleteOne(d.GetID(), a)
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ func (a *bookingMongoAccessor) Search(filters *dbs.Filters, search string, isDra
|
|||||||
func (a *bookingMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
func (a *bookingMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
||||||
return func(d utils.DBObject) utils.ShallowDBObject {
|
return func(d utils.DBObject) utils.ShallowDBObject {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
now = now.Add(time.Second * 60)
|
now = now.Add(time.Second * -60)
|
||||||
if d.(*Booking).State == enum.DRAFT && now.UTC().After(d.(*Booking).ExpectedStartDate) {
|
if d.(*Booking).State == enum.DRAFT && now.UTC().After(d.(*Booking).ExpectedStartDate) {
|
||||||
utils.GenericDeleteOne(d.GetID(), a)
|
utils.GenericDeleteOne(d.GetID(), a)
|
||||||
return nil
|
return nil
|
||||||
|
@ -48,7 +48,7 @@ func (p *PeerCache) urlFormat(url string, dt tools.DataType) string {
|
|||||||
url = strings.ReplaceAll(url, localhost, dt.API()+":8080/oc")
|
url = strings.ReplaceAll(url, localhost, dt.API()+":8080/oc")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url = url + "/" + dt.API()
|
url = url + "/" + strings.ReplaceAll(dt.API(), "oc-", "")
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func (wfa *workflowExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.D
|
|||||||
func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
func (a *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||||
return utils.GenericLoadOne[*WorkflowExecution](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
return utils.GenericLoadOne[*WorkflowExecution](id, func(d utils.DBObject) (utils.DBObject, int, error) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
now = now.Add(time.Second * 60)
|
now = now.Add(time.Second * -60)
|
||||||
if d.(*WorkflowExecution).State == enum.DRAFT && !a.shallow && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
if d.(*WorkflowExecution).State == enum.DRAFT && !a.shallow && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||||
return nil, 404, errors.New("not found")
|
return nil, 404, errors.New("not found")
|
||||||
@ -85,7 +85,7 @@ func (a *workflowExecutionMongoAccessor) Search(filters *dbs.Filters, search str
|
|||||||
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
func (a *workflowExecutionMongoAccessor) getExec() func(utils.DBObject) utils.ShallowDBObject {
|
||||||
return func(d utils.DBObject) utils.ShallowDBObject {
|
return func(d utils.DBObject) utils.ShallowDBObject {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
now = now.Add(time.Second * 60)
|
now = now.Add(time.Second * -60)
|
||||||
if d.(*WorkflowExecution).State == enum.DRAFT && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
if d.(*WorkflowExecution).State == enum.DRAFT && now.UTC().After(d.(*WorkflowExecution).ExecDate) {
|
||||||
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
utils.GenericDeleteOne(d.GetID(), newShallowAccessor(a.Request))
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user