code: func (c *Client) pendingRequestsReaper() {
  	ticker := time.NewTicker(1 * time.Second)
  	defer ticker.Stop()
  	for {
  		select {
  		case <-ticker.C:
  			toDelete := make([]*pendingRequest, 0)
  			c.pendingReqMutex.Lock()
  			for _, v := range c.pendingRequests {
  				if time.Now().Sub(v.sentAt) > c.requestTimeout {
  					toDelete = append(toDelete, v)
  				}
  			}
  			for _, pendingReq := range toDelete {
  				err := pitaya.Error(errors.New("request timeout"), "PIT-504")
  				errMarshalled, _ := json.Marshal(err)
  				// send a timeout to incoming msg chan
  				m := &message.Message{
  					Type:  message.Response,
  					ID:    pendingReq.msg.ID,
  					Route: pendingReq.msg.Route,
  					Data:  errMarshalled,
  					Err:   true,
  				}
  				delete(c.pendingRequests, pendingReq.msg.ID)
  				<-c.pendingChan
  				c.IncomingMsgChan <- m
  			}
  			c.pendingReqMutex.Unlock()
  		case <-c.closeChan:
  			return
  		}
  	}
  }
docs: // pendingRequestsReaper delete timedout requests