Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
fix burst not work bug
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Jan 20, 2015
1 parent 6b02ed5 commit 0f43efc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyspider/database/local/projectdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ def __init__(self, files):
continue
self.projects[project['name']] = project

rate_re = re.compile(r'^\s*#\s*rate.*(\d+(\.\d+)?)', re.I)
burst_re = re.compile(r'^\s*#\s*burst.*(\d+(\.\d+)?)', re.I)
rate_re = re.compile(r'^\s*#\s*rate.*?(\d+(\.\d+)?)', re.I | re.M)
burst_re = re.compile(r'^\s*#\s*burst.*?(\d+(\.\d+)?)', re.I | re.M)

def _build_project(self, filename):
try:
with open(filename) as fp:
script = fp.read()
m = self.rate_re.match(script)
m = self.rate_re.search(script)
if m:
rate = float(m.group(1))
else:
rate = 1

m = self.burst_re.match(script)
m = self.burst_re.search(script)
if m:
burst = float(m.group(1))
else:
Expand Down

0 comments on commit 0f43efc

Please sign in to comment.