func (s *OpencxAuctionServer) AuctionClock() {
	logging.Infof("Starting Auction Clock!")

	// We make the variables here because we don't want to fill up our memory with stuff in the loop
	doneChan := make(chan time.Time, 1)
	var tickDone time.Time

	// afterTick is how we call the auction tick
	afterTick := func() {
		s.auctionTick(doneChan)
	}

	// FOR STATS / DEBUG
	var m *runtime.MemStats
	m = new(runtime.MemStats)

	for {
		// Read mem stats FOR STATISTICS
		runtime.ReadMemStats(m)

		logging.Debugf("MEMORY STATS BEFORE: %d heap allocated, %d allocated", m.HeapAlloc, m.Alloc)
		logging.Infof("Auction clock tick!")

		// TODO: configurable time, work out schedule, base it on the AuctionTime option
		time.AfterFunc(time.Duration(s.t)*time.Microsecond, afterTick)

		logging.Infof("Waiting for tick")

		// retrieve the tick from the channel
		tickDone = <-doneChan

		logging.Infof("Tick done at %s", tickDone.String())
		logging.Debugf("MEMORY STATS AFTER: %d heap allocated, %d allocated", m.HeapAlloc, m.Alloc)
	}
}
// AuctionClock should be run in a goroutine and just commit to puzzles after some time
AuctionClock should be run in a goroutine and just commit to puzzles after some time
// AuctionClock should be run in a goroutine and just commit to puzzles after some time
func (s *OpencxAuctionServer) AuctionClock() {
	logging.Infof("Starting Auction Clock!")
	doneChan := make(chan time.Time, 1)
	var tickDone time.Time
	afterTick := func() {
		s.auctionTick(doneChan)
	}
	var m *runtime.MemStats
	m = new(runtime.MemStats)
	for {
		runtime.ReadMemStats(m)
		logging.Debugf("MEMORY STATS BEFORE: %d heap allocated, %d allocated", m.HeapAlloc, m.Alloc)
		logging.Infof("Auction clock tick!")
		time.AfterFunc(time.Duration(s.t)*time.Microsecond, afterTick)
		logging.Infof("Waiting for tick")
		tickDone = <-doneChan
		logging.Infof("Tick done at %s", tickDone.String())
		logging.Debugf("MEMORY STATS AFTER: %d heap allocated, %d allocated", m.HeapAlloc, m.Alloc)
	}
}
func ( s * OpencxAuctionServer ) AuctionClock ( ) { logging . Infof ( " " ) doneChan := make ( chan time . Time , 1 ) var tickDone time . Time afterTick := func ( ) { s . auctionTick ( doneChan ) } var m * runtime . MemStats m = new ( runtime . MemStats ) for { runtime . ReadMemStats ( m ) logging . Debugf ( " " , m . HeapAlloc , m . Alloc ) logging . Infof ( " " ) time . AfterFunc ( time . Duration ( s . t ) * time . Microsecond , afterTick ) logging . Infof ( " " ) tickDone = <- doneChan logging . Infof ( " " , tickDone . String ( ) ) logging . Debugf ( " " , m . HeapAlloc , m . Alloc ) } }
AuctionClock should be run in a goroutine and just commit to puzzles after some time
AuctionClock should be run in a goroutine and just commit to puzzles after some time
// We make the variables here because we don't want to fill up our memory with stuff in the loop // afterTick is how we call the auction tick // FOR STATS / DEBUG // Read mem stats FOR STATISTICS // TODO: configurable time, work out schedule, base it on the AuctionTime option // retrieve the tick from the channel