code: func (s *StanServer) performRedeliveryOnStartup(recoveredSubs []*subState) {
  	queues := make(map[*queueState]*channel)
  
  	for _, sub := range recoveredSubs {
  		// Ignore subs that did not have any ack pendings on startup.
  		sub.Lock()
  		// Consider this subscription ready to receive messages
  		sub.initialized = true
  		// If this is a durable and it is offline, then skip the rest.
  		if sub.isOfflineDurableSubscriber() {
  			sub.newOnHold = false
  			sub.Unlock()
  			continue
  		}
  		// Unlock in order to call function below
  		sub.Unlock()
  		// Send old messages (lock is acquired in that function)
  		s.performAckExpirationRedelivery(sub, true)
  		// Regrab lock
  		sub.Lock()
  		// Allow new messages to be delivered
  		sub.newOnHold = false
  		subject := sub.subject
  		qs := sub.qstate
  		sub.Unlock()
  		c := s.channels.get(subject)
  		if c == nil {
  			continue
  		}
  		// Kick delivery of (possible) new messages
  		if qs != nil {
  			queues[qs] = c
  		} else {
  			s.sendAvailableMessages(c, sub)
  		}
  	}
  	// Kick delivery for queues that had members with newOnHold
  	for qs, c := range queues {
  		qs.Lock()
  		qs.newOnHold = false
  		qs.Unlock()
  		s.sendAvailableMessagesToQueue(c, qs)
  	}
  }
docs: // Redelivers unacknowledged messages, releases the hold for new messages delivery,
  // and kicks delivery of available messages.