-
Notifications
You must be signed in to change notification settings - Fork 569
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
check if a spider exists before schedule it (with sqlite cache) #17
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -7,6 +8,28 @@ | |||
from scrapy.utils.python import stringify_dict, unicode_to_str | |||
from scrapyd.config import Config | |||
|
|||
class UtilsCache: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a class level doc to explain what it does?
looks good to me, @pablohoffman thoughts? |
I will go ahead to pull this pull |
jayzeng
added a commit
that referenced
this pull request
Jul 10, 2014
check if a spider exists before schedule it (with sqlite cache)
OK, but we should probably move this check to store data in whatever database scrapyd ends up using for persisting data. |
jpmckinney
added a commit
that referenced
this pull request
Jul 22, 2024
UtilsCache.__init__ calls JsonSqliteDict(table="utils_cache_manager"), which uses ":memory:" as the database. A comment in #17 suggests persisting this cache. However, there isn no contract that egg storage must only be modified by Scrapyd. (For example, users can happily store eggs in the egg directory, before deploying Scrapyd.) Without persistence, there is really no reason to use SQLite. We can therefore use a simpler approach. This changes the get_spider_list function to a SpiderList class - Require the runner agument - Remove the pythonpath argument (unused) - Remove the config argument (see next commit) - Use get(), set() and delete() methods, instead of having to invalidate the cache with calls to UtilsCache - Evict only the specified version and default version on delversion.json, instead of all versions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I pulled #8 to my local repo and added sqlite caching like pablohoffman suggested. I ran some performance tests using apache bench, and its ok.