func (us userStore) Clean() {
	us.m.Lock()
	defer us.m.Unlock()
	var newE []tEvent
	var newQ []tQueue
	var newT []Trades
	var newO []Offers
	for k, v := range us.user {
		// remove events
		for _, event := range v.events {
			if time.Now().Sub(event.expire) > 0 {
				// remove this event
				continue
			}
			newE = append(newE, event)
		}
		us.user[k].events = newE
		// remove queues
		for _, queue := range v.queues {
			if time.Now().Sub(queue.expire) > 0 {
				// remove this queue
				continue
			}
			newQ = append(newQ, queue)
		}
		us.user[k].queues = newQ
		// remove trades
		for _, trade := range v.trades {
			if time.Now().Sub(trade.expire) > 0 {
				continue
			}
			newT = append(newT, trade)
		}
		us.user[k].trades = newT
		// remove offers
		for _, offer := range v.offer {
			if time.Now().Sub(offer.expire) > 0 {
				continue
			}
			newO = append(newO, offer)
		}
		us.user[k].offer = newO
	}
}
// Clean will remove event listings from tracking that have exceeded time limit
//
// DO NOT CALL THIS RANDOMLY!!
//
// This should only be called in the goroutine in main (ticker to check expiration)
Clean will remove event listings from tracking that have exceeded time limit

DO NOT CALL THIS RANDOMLY

This should only be called in the goroutine in main (ticker to check expiration)
// Clean will remove event listings from tracking that have exceeded time limit // // DO NOT CALL THIS RANDOMLY!! // // This should only be called in the goroutine in main ( ticker to check expiration )
func (us userStore) Clean() {
	us.m.Lock()
	defer us.m.Unlock()
	var newE []tEvent
	var newQ []tQueue
	var newT []Trades
	var newO []Offers
	for k, v := range us.user {
		for _, event := range v.events {
			if time.Now().Sub(event.expire) > 0 {
				continue
			}
			newE = append(newE, event)
		}
		us.user[k].events = newE
		for _, queue := range v.queues {
			if time.Now().Sub(queue.expire) > 0 {
				continue
			}
			newQ = append(newQ, queue)
		}
		us.user[k].queues = newQ
		for _, trade := range v.trades {
			if time.Now().Sub(trade.expire) > 0 {
				continue
			}
			newT = append(newT, trade)
		}
		us.user[k].trades = newT
		for _, offer := range v.offer {
			if time.Now().Sub(offer.expire) > 0 {
				continue
			}
			newO = append(newO, offer)
		}
		us.user[k].offer = newO
	}
}
func ( us userStore ) Clean ( ) { us . m . Lock ( ) defer us . m . Unlock ( ) var newE [ ] tEvent var newQ [ ] tQueue var newT [ ] Trades var newO [ ] Offers for k , v := range us . user { for _ , event := range v . events { if time . Now ( ) . Sub ( event . expire ) > 0 { continue } newE = append ( newE , event ) } us . user [ k ] . events = newE for _ , queue := range v . queues { if time . Now ( ) . Sub ( queue . expire ) > 0 { continue } newQ = append ( newQ , queue ) } us . user [ k ] . queues = newQ for _ , trade := range v . trades { if time . Now ( ) . Sub ( trade . expire ) > 0 { continue } newT = append ( newT , trade ) } us . user [ k ] . trades = newT for _ , offer := range v . offer { if time . Now ( ) . Sub ( offer . expire ) > 0 { continue } newO = append ( newO , offer ) } us . user [ k ] . offer = newO } }
Clean will remove event listings from tracking that have exceeded time limit
Clean will remove event listings from tracking that have exceeded time limit
// remove events // remove this event // remove queues // remove this queue // remove trades // remove offers