func (e *expire) ComputeExpires() []*TagInfo {
	var expiredEntities []*TagInfo
	now := time.Now()

	e.Lock()
	defer e.Unlock()

	if now.Sub(e.lastExpire) < e.expiryDuration {
		return nil
	}

	for id, seen := range e.lastSeen {
		if now.Sub(seen) < e.expiryDuration {
			continue
		}

		expiredEntities = append(expiredEntities, &TagInfo{
			Source:       e.source,
			Entity:       id,
			DeleteEntity: true,
		})

		delete(e.lastSeen, id)
	}

	e.lastExpire = now

	return expiredEntities
}
// ComputeExpires should be called right after an Update.
ComputeExpires should be called right after an Update.
// ComputeExpires should be called right after an Update .
func (e *expire) ComputeExpires() []*TagInfo {
	var expiredEntities []*TagInfo
	now := time.Now()
	e.Lock()
	defer e.Unlock()
	if now.Sub(e.lastExpire) < e.expiryDuration {
		return nil
	}
	for id, seen := range e.lastSeen {
		if now.Sub(seen) < e.expiryDuration {
			continue
		}
		expiredEntities = append(expiredEntities, &TagInfo{
			Source:       e.source,
			Entity:       id,
			DeleteEntity: true,
		})
		delete(e.lastSeen, id)
	}
	e.lastExpire = now
	return expiredEntities
}
func ( e * expire ) ComputeExpires ( ) [ ] * TagInfo { var expiredEntities [ ] * TagInfo now := time . Now ( ) e . Lock ( ) defer e . Unlock ( ) if now . Sub ( e . lastExpire ) < e . expiryDuration { return nil } for id , seen := range e . lastSeen { if now . Sub ( seen ) < e . expiryDuration { continue } expiredEntities = append ( expiredEntities , & TagInfo { Source : e . source , Entity : id , DeleteEntity : true , } ) delete ( e . lastSeen , id ) } e . lastExpire = now return expiredEntities }
ComputeExpires should be called right after an Update.
ComputeExpires should be called right after an Update .