kill process... may be infinite if no end
This commit is contained in:
parent
cb23289097
commit
81167f7b86
@ -130,9 +130,11 @@ func (p *PrometheusService) Call(book *booking.Booking) (*booking.Booking, map[s
|
||||
var LockKill = &sync.Mutex{}
|
||||
|
||||
func (p *PrometheusService) Stream(bookingID string, end *time.Time, interval time.Duration, flusher *http.Flusher, encoder *json.Encoder) {
|
||||
e := time.Now().UTC().Add(time.Hour * 1)
|
||||
if end != nil {
|
||||
e = (*end).UTC()
|
||||
f := func(e *time.Time) bool {
|
||||
if end == nil {
|
||||
return true
|
||||
}
|
||||
return time.Now().Before(*e)
|
||||
}
|
||||
max := 100
|
||||
bookIDS := []string{}
|
||||
@ -142,7 +144,8 @@ func (p *PrometheusService) Stream(bookingID string, end *time.Time, interval ti
|
||||
if book.Err != "" {
|
||||
fmt.Errorf("stop because of empty : %s", book.Err)
|
||||
}
|
||||
for time.Now().Before(e) {
|
||||
|
||||
for f(end) {
|
||||
if slices.Contains(Kill, book.Data.(*booking.Booking).ExecutionsID) {
|
||||
newKill := []string{}
|
||||
for _, k := range Kill {
|
||||
|
Loading…
Reference in New Issue
Block a user