Skip to content

Commit

Permalink
Rename for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
danpalmer committed Jan 4, 2018
1 parent e485628 commit 606b673
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion routemaster/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def _pre_warm_feeds(self, label: str, accessed_variables: Iterable[str]):

feed = self.feeds.get(parts[1])
if feed is not None:
feed.fetch(label)
feed.prefetch(label)
2 changes: 1 addition & 1 deletion routemaster/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, url, state_machine):
self.data = None
self.state_machine = state_machine

def fetch(self, label: str):
def prefetch(self, label: str):
"""Trigger the fetching of a feed's data."""
if self.data is not None:
return
Expand Down
8 changes: 4 additions & 4 deletions routemaster/tests/test_feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def test_fetch_only_once():
feed = Feed('http://example.com/<state_machine>/<label>', 'test_machine')

with mock.patch('requests.Response.json') as json:
feed.fetch('label1')
feed.fetch('label1')
feed.fetch('label1')
feed.prefetch('label1')
feed.prefetch('label1')
feed.prefetch('label1')

assert json.call_count == 1

Expand All @@ -61,7 +61,7 @@ def test_lookup():
)

feed = Feed('http://example.com/<state_machine>/<label>', 'test_machine')
feed.fetch('label1')
feed.prefetch('label1')

assert feed.lookup(('foo',)) == 'bar'

Expand Down

0 comments on commit 606b673

Please sign in to comment.