class MyScheduler(Scheduler):

    def enqueue_request(self, request):
        if not request.dont_filter and self.df.request_seen(request, self.
            spider):
            self.df.log(request, self.spider)
return False
dqok = self._dqpush(request)
if dqok:
    self.stats.inc_value('scheduler/enqueued/disk', spider=self.spider)
else:
    self._mqpush(request)
self.stats.inc_value('scheduler/enqueued/memory', spider=self.spider)
self.stats.inc_value('scheduler/enqueued', spider=self.spider)
return True
Scrapy - Retrieve spider object in dupefilter