Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection does not close #85

Closed
kikdevops opened this issue Jun 7, 2018 · 1 comment
Closed

connection does not close #85

kikdevops opened this issue Jun 7, 2018 · 1 comment

Comments

@kikdevops
Copy link

Hi.
I'm trying to write a key with a value in the memcached server but the client connection is not closed. I use this functions in aiohttp.web.Application.
`

async def mc_write(key, an):
    mc = aiomcache.Client("memcached", 11211)
    await mc.set(key.encode(encoding='UTF-8'), an.encode(encoding='UTF-8'))
    mc.close()

async def Handler(body, headers, key, url):
    logging.info("Start processing key: {}".format(key))

    try:
        async with aiohttp.ClientSession() as session:
            async with session.post(url, data=body, headers=headers) as resp:
                an = await resp.text()
                end = time.time()
    except Exception as e:
        return e

#Send result to memcache
    await mc_write(key, an)`

On memcached server i see lots of connections:
``
lsof -p 1 | grep ESTABLISHED | wc -l

12
``
What I'm do wrong, how I can close connections?

@kikdevops
Copy link
Author

My bad
await mc.close()
solve issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant