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

downloader-aware scheduler cleanups #2

Conversation

kmike
Copy link

@kmike kmike commented Dec 26, 2018

Changes are rather mechanical so far, I haven't got to more complex parts yet.

Request.meta is always a dict
also, do some bike-shedding: _pathable -> _path_safe
* PriorityAsTupleQueue.is_empty does the same as len(self) == 0
* custom PriorityAsTupleQueue.close is not needed after a switch
  to namedtuples
* is_new and is_empty return values are unused
* "url" local variable is unused
* remove mutable default arguments
* more verbose variable names
slot = urlparse_cached(request).hostname or ''

# FIXME: meta is not modified when request is a dict and no meta is stored?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address this concern we should preserve

if isinstance(request, dict):
and replace meta = request.get('meta', dict()) by meta = request.setdefault('meta', dict()) inside this code

Copy link
Owner

@whalebot-helmsman whalebot-helmsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave comments on small improvements possible here and there

* SlotPriorityQueues doesn't care about objects inside, it is now just
  a container for multiple priority queues
* assorted variable renames
* don't inherit DownloaderAwarePriorityQueue from SlotBasedPriorityQueue
* apply @whalebot-helmsman's suggestions for __slots__ and meta issues
@whalebot-helmsman
Copy link
Owner

Thanks @kmike

@whalebot-helmsman whalebot-helmsman merged commit c9c349e into whalebot-helmsman:round-robin-scheduler-tested Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants