You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first glance it looks okay - no hosts to ping means no errors, but there are a couple of problems:
An actual client is constructed which is essentially non functional. Furthermore New() doesn't return an error and the only way to verify if the client is in fact functional is to run another operation.
If we add further statements such as err = c.Add(&memcache.Item{Key: "k", Value: []byte("v")}) those will fail which leads to inconsistent behaviour in the API.
I suppose there are 2 ways to fix that - either change Ping() to check the hosts size, or change New() to do that and return an error
The text was updated successfully, but these errors were encountered:
I noticed the following code works fine:
At first glance it looks okay - no hosts to ping means no errors, but there are a couple of problems:
New()
doesn't return an error and the only way to verify if the client is in fact functional is to run another operation.err = c.Add(&memcache.Item{Key: "k", Value: []byte("v")})
those will fail which leads to inconsistent behaviour in the API.I suppose there are 2 ways to fix that - either change
Ping()
to check the hosts size, or changeNew()
to do that and return an errorThe text was updated successfully, but these errors were encountered: