Skip to content

Commit

Permalink
MemoryRandomOverusedBackend used in grequests example.
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiryakov committed Feb 10, 2015
1 parent dcbfbb1 commit 5a5c9e3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crawlfrontier/contrib/backends/memory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ def get_next_requests(self, max_n_requests, downloader_info):
return self._buffer.get_next_requests(max_n_requests, downloader_info)


class MemoryRandomOverusedBackend(MemoryRandomBackend):
component_name = 'Random Memory Backend taking into account overused slots'

def __init__(self, manager):
super(MemoryRandomOverusedBackend, self).__init__(manager)
self._buffer = OverusedBuffer(super(MemoryRandomOverusedBackend, self).get_next_requests,
manager.logger.manager.debug)

def get_next_requests(self, max_n_requests, downloader_info):
return self._buffer.get_next_requests(max_n_requests, downloader_info)


BASE = MemoryBaseBackend
FIFO = MemoryFIFOBackend
LIFO = MemoryLIFOBackend
Expand Down

0 comments on commit 5a5c9e3

Please sign in to comment.