@@ -20,18 +20,10 @@ def load_crawler_class(class_path):
2020DEFAULT_CRAWLER_CLASS = f"{ Crawler .__module__ } .{ Crawler .__name__ } "
2121
2222REACTORS = {
23- "twisted" : lambda settings : settings .set ("TWISTED_REACTOR" , None , "command" ),
24- "poll" : lambda settings : settings .set (
25- "TWISTED_REACTOR" , "twisted.internet.pollreactor.PollReactor" , "command"
26- ),
27- "select" : lambda settings : settings .set (
28- "TWISTED_REACTOR" , "twisted.internet.selectreactor.SelectReactor" , "command"
29- ),
30- "asyncio" : lambda settings : settings .set (
31- "TWISTED_REACTOR" ,
32- "twisted.internet.asyncioreactor.AsyncioSelectorReactor" ,
33- "command" ,
34- ),
23+ "twisted" : None ,
24+ "poll" : "twisted.internet.pollreactor.PollReactor" ,
25+ "select" : "twisted.internet.selectreactor.SelectReactor" ,
26+ "asyncio" : "twisted.internet.asyncioreactor.AsyncioSelectorReactor" ,
3527}
3628
3729
@@ -64,7 +56,7 @@ def process_options(self, args, opts):
6456 if opts .crawler_class :
6557 self .settings .set ("CRAWLER_CLASS" , opts .crawler_class , "cmdline" )
6658 if opts .reactor :
67- REACTORS [opts .reactor ]( self . settings )
59+ self . settings . set ( "TWISTED_REACTOR" , REACTORS [opts .reactor ], "cmdline" )
6860
6961 def _create_crawler (self , spname ):
7062 c = self .settings .get ("CRAWLER_CLASS" )
0 commit comments