在Go并发模式中订阅Podio Push服务时出现4xx错误

I'm experiencing some unexpected errors while trying to subscribe on Podio Push service. I use golang concurrency pattern defined here and here is the bayeux client library used for subscription.

Basically the flow tries to retrieve the item first and then subscribe into push object provided with the item object. There is channel object where i store each task (taskLoad: ~each item_id with credentials it needs for retrieval)

item := new(podio.Item)
item, err = podio.GetItem(itemId)
if err != nil {
    log.Errorf("PODIO", "Could not get item %d -> %s", itemId, err)

    return
}

and, later inside another func

messages := make(chan *bayeux.Message)
server := GetBayeux()
defer server.Close()

if err = push.Subscribe(server, messages); err != nil {
    // log err, with item details
    log.Errorf("PODIO", "%s", err, push)

    // re-enqueue the task in taskLoad channel
    go enqueueTask(true, messages, sigrepeat, timer)

    // release sigwait channel on subscription error
    <-sigwait

    return
}

here GetBayeux func is just a singleton which wraps the client

func GetBayeux() *bayeux.Client {
    bayeuxOnce.Do(func() {
        Bayeux = bayeux.NewClient("https://push.podio.com/faye", nil)
    })

    return Bayeux
}

there is about ~15000 items to listen and I should subscribe to each of them but unfortunately sometimes I got one of these errors while processing subscriptions

401:k9jx3v4qq276k9q84gokpqirhjrfbyd:Unknown client [{"channel":"/item/9164xxxxx","signature":"46bd8ab3ef2a31297d8f4f5ddxxxx","timestamp":"2018-01-02T14:34:02Z","expires_in":21600}]

OR

HTTP Status 400 [{"channel":"/item/9158xxxxx","signature":"31bf8b4697ca2fda69bd7fd532d08xxxxxx","timestamp":"2018-01-02T14:37:02Z","expires_in":21600}]

OR

[WRN] Bayeux connect failed: HTTP Status 400

OR

Bayeux connect failed: Post https://push.podio.com/faye: http2: server sent GOAWAY and closed the connection; LastStreamID=1999, ErrCode=NO_ERROR, debug=""

So now, i'd like to know why i got these errors and most of all how i can fix them to ensure to listen to all items in the scope.

If anyone knows, is there any limitation about concurrent access into podio push service?

Thanks

UPDATE 2019-01-07

it was the singleton that messed the process. as it was in a goroutine context there was some subscriptions that was not allowed because the server has been closed by another goroutine. The fix was to exposing Unsubscribe method and use it instead of Close method which disconnect the client from the server.

defer server.Close()

became

defer push.Unsubscribe(server)