Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

doc/typo fixes #131

Merged
merged 4 commits into from
Nov 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ wraps Psycopg2, the `Psycopg2 documentation`_ must be used alongside Momoko's.

The principle
-------------
All of the :py:meth:`~momoko.Pool` and :py:meth:`~momoko.Connection` methods return
_futures. There are some notable exceptions like :py:meth:`~momoko.Pool.close` - make sure
to consule API documentation for the details.
Almost every method of :py:meth:`~momoko.Pool` and :py:meth:`~momoko.Connection`
returns a `future`_. There are some notable exceptions, like
:py:meth:`~momoko.Pool.close`; be sure to consult API documentation for the
details.

These future objects can be simply ``yield``-ed in Tornado methods decorated with ``gen.coroutine``.
For SQL execution related methods these futures resolve to corresponding cursor objects.
Expand Down Expand Up @@ -226,4 +227,4 @@ Here is the server-side cursor example (based on the code in momoko unittests)::
.. _Wait: http://tornado.readthedocs.org/en/stable/gen.html#tornado.gen.Wait
.. _WaitAll: http://tornado.readthedocs.org/en/stable/gen.html#tornado.gen.WaitAll
.. _exceptions: http://initd.org/psycopg/docs/module.html#exceptions
.. _futures: http://tornado.readthedocs.org/en/latest/concurrent.html
.. _future: http://tornado.readthedocs.org/en/latest/concurrent.html
18 changes: 9 additions & 9 deletions momoko/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Pool(object):
connect to database during :py:meth:`momoko.Pool.connect`.

:param int reconnect_interval:
If database server becomes unavailble, the pool will try to reestablish
If database server becomes unavailable, the pool will try to reestablish
the connection. The attempt frequency is ``reconnect_interval``
milliseconds.

Expand Down Expand Up @@ -244,7 +244,7 @@ def __init__(self,
self.conns = ConnectionContainer()

self._last_connect_time = 0
self._no_conn_availble_error = self.DatabaseNotAvailable("No database connection available")
self._no_conn_available_error = self.DatabaseNotAvailable("No database connection available")
self.shrink_period = shrink_period
self.shrink_delay = shrink_delay
self.auto_shrink = auto_shrink
Expand Down Expand Up @@ -286,13 +286,13 @@ def getconn(self, ping=True):
"""
Acquire connection from the pool.

You can then use this connection for subsequest queries.
You can then use this connection for subsequent queries.
Just use ``connection.execute`` instead of ``Pool.execute``.

Make sure to return connection to the pool by calling :py:meth:`momoko.Pool.putconn`,
otherwise the connection will remain forever-busy and you'll starvate your pool quickly.
otherwise the connection will remain forever busy and you'll starve your pool.

Returns future that resolves to the acquired connection object.
Returns a future that resolves to the acquired connection object.

:param boolean ping:
Whether to ping the connection before returning it by executing :py:meth:`momoko.Connection.ping`.
Expand All @@ -307,7 +307,7 @@ def getconn(self, ping=True):

def on_reanimate_done(fut):
if self.conns.all_dead:
future.set_exception(self._no_conn_availble_error)
future.set_exception(self._no_conn_available_error)
return
f = self.conns.acquire()
assert isinstance(f, Future)
Expand All @@ -333,7 +333,7 @@ def putconn(self, connection):
self.conns.release(connection)

if self.conns.all_dead:
self.conns.abort_waiting_queue(self._no_conn_availble_error)
self.conns.abort_waiting_queue(self._no_conn_available_error)

@contextmanager
def manage(self, connection):
Expand Down Expand Up @@ -495,7 +495,7 @@ def _retry(self, retry, what, conn, keep, future):
self.ioloop.add_future(conn.connect(), what)
return
else:
future.set_exception(self._no_conn_availble_error)
future.set_exception(self._no_conn_available_error)
else:
future.set_exc_info(sys.exc_info())
if not keep:
Expand Down Expand Up @@ -580,7 +580,7 @@ def on_ping_done(ping_fut):
ping_fut.result()
except psycopg2.Error as error:
if conn.closed:
ping_future.set_exception(self._no_conn_availble_error)
ping_future.set_exception(self._no_conn_available_error)
else:
ping_future.set_exc_info(sys.exc_info())
self.putconn(conn)
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ def test_request_queueing(self):
self.run_parallel_queries(self.pool_size*2)

def test_parallel_queries_after_reconnect_all(self):
"""Testing that pool still queries database in parallel after ALL connections were closeded"""
"""Testing that pool still queries database in parallel after ALL connections were closed"""
self.shutter(self.db)
self.run_parallel_queries()

Expand Down