File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ the commands.
8989` invoke start ` (possibly with ` nohup ` )
9090
9191## Changelog
92+ ### v0.6.0-beta
93+ * Update subreddit monitoring implementation (fixes #25 )
9294### v0.5.0-beta
9395* Fix program crash when exception occurs (@yleong PR #22 )
9496* Fix exception in handling Ricemedia links (@yleong PR #20 )
Original file line number Diff line number Diff line change 1111RUN_EVERY = 2
1212
1313BOT = {
14- "VERSION" : "0.5 .0-beta" ,
14+ "VERSION" : "0.6 .0-beta" ,
1515 "REPO_LINK" : "https://github.com/fterh/sneakpeek" ,
1616 "CONTRIBUTE_LINK" : "https://github.com/fterh/sneakpeek"
1717}
Original file line number Diff line number Diff line change @@ -22,19 +22,15 @@ def start():
2222 try :
2323 scan (reddit .subreddit (config .SUBREDDIT ))
2424 except Exception as e :
25- print ("Exception occurred while scanning" )
25+ # This should never happen,
26+ # because it breaks the infinite subreddit monitoring
27+ # provided by subreddit.stream.submissions()
28+ print ("Exception occurred while scanning. This should never happen!" )
2629 traceback .print_exc ()
2730
2831
2932 DatabaseManager .disconnect ()
3033
3134
32- schedule .every (config .RUN_EVERY ).minutes .do (start )
33-
34-
3535if __name__ == "__main__" :
3636 start ()
37- while True :
38- schedule .run_pending ()
39- print ("Sleeping" )
40- time .sleep (1 )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def scan(subreddit):
1111 """Scan a Subreddit for new submissions."""
1212 print ("Starting scan" )
1313
14- for submission in subreddit .new ( limit = config . LIMIT ):
14+ for submission in subreddit .stream . submissions ( ):
1515 print ("Operating on submission ID: " + submission .id )
1616
1717 does_qualify = qualify (submission )
You can’t perform that action at this time.
0 commit comments