Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8fba10

Browse files
committed
Flask-Hypertable v0.2.1 Added HYPERTABLE_TIMEOUT_MSECS option (defaults
to 5000 msecs)
1 parent 192a814 commit b8fba10

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

CHANGES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ Here you can find the recent changes to Flask Hypertable.
1313

1414
Updated CHANGES.
1515

16+
.. changelog::
17+
:version: 0.2.1
18+
:released: 2014-03-30
19+
20+
.. change::
21+
:tags: project
22+
23+
Added HYPERTABLE_TIMEOUT_MSECS option (defaults to 5000 msecs)
24+
1625
.. changelog::
1726
:version: 0.2.0
1827
:released: 2014-03-26

docs/usage.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Your configuration should be declared within your Flask config::
2323

2424
HYPERTABLE_HOST = "localhost"
2525
HYPERTABLE_PORT = 38080
26+
HYPERTABLE_TIMEOUT_MSECS = 5000
2627

2728
################
2829
#if using FlaskPooledHypertable

flask_hypertable/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
__author__ = 'Fairiz Azizi'
1818
__description__ = 'A Flask extension for Hypertable over Thrift.'
1919
__email__ = '[email protected]'
20-
__version__ = '0.2.0'
20+
__version__ = '0.2.1'
2121
__license__ = 'BSD'
2222
__copyright__ = 'Copyright 2014 Fairiz Azizi'
2323

flask_hypertable/flask_hypertable.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class FlaskHypertable(object):
3333
3434
HYPERTABLE_HOST: 'localhost'
3535
HYPERTABLE_PORT: 38080
36+
HYPERTABLE_TIMEOUT_MSECS: 5000
3637
3738
Under the hood, this extension uses the ``ManagedThriftClient``.
3839
"""
@@ -53,6 +54,11 @@ def init_app(self, app):
5354
"""
5455
app.config.setdefault('HYPERTABLE_HOST', 'localhost')
5556
app.config.setdefault('HYPERTABLE_PORT', 38080)
57+
app.config.setdefault("HYPERTABLE_TIMEOUT_MSECS", 5000)
58+
59+
self.host = self.app.config['HYPERTABLE_HOST']
60+
self.port = self.app.config['HYPERTABLE_PORT']
61+
self.timeout_msecs = self.app.config['HYPERTABLE_TIMEOUT_MSECS']
5662

5763
# Use the newstyle teardown_appcontext if it's available,
5864
# otherwise fall back to the request context
@@ -72,8 +78,9 @@ def connect(self):
7278
""" Creates a new Thrift client
7379
:return: ``ManagedThriftClient``
7480
"""
75-
return ManagedThriftClient(current_app.config['HYPERTABLE_HOST'],
76-
current_app.config['HYPERTABLE_PORT'])
81+
return ManagedThriftClient(self.host,
82+
self.port,
83+
timeout_ms=self.timeout_msecs)
7784

7885
def teardown(self, exception):
7986
""" Puts the connection object back into the pool. """

0 commit comments

Comments
 (0)