mirror of
https://github.com/simon987/od-database.git
synced 2025-04-20 10:56:47 +00:00
Modified timeout values
This commit is contained in:
parent
d138db8f06
commit
35b40f002d
8
task.py
8
task.py
@ -33,7 +33,7 @@ class CrawlServer:
|
|||||||
try:
|
try:
|
||||||
payload = json.dumps(task.to_json())
|
payload = json.dumps(task.to_json())
|
||||||
r = requests.post(self.url + "/task/put", headers=self._generate_headers(), data=payload, verify=False,
|
r = requests.post(self.url + "/task/put", headers=self._generate_headers(), data=payload, verify=False,
|
||||||
timeout=5)
|
timeout=20)
|
||||||
print(r) # TODO: If the task could not be added, fallback to another server
|
print(r) # TODO: If the task could not be added, fallback to another server
|
||||||
return r.status_code == 200
|
return r.status_code == 200
|
||||||
except (ConnectionError, ReadTimeout):
|
except (ConnectionError, ReadTimeout):
|
||||||
@ -42,7 +42,7 @@ class CrawlServer:
|
|||||||
def pop_completed_tasks(self) -> list:
|
def pop_completed_tasks(self) -> list:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(self.url + "/task/completed", headers=self._generate_headers(), verify=False, timeout=5)
|
r = requests.get(self.url + "/task/completed", headers=self._generate_headers(), verify=False, timeout=15)
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
print("Problem while fetching completed tasks for '" + self.name + "': " + str(r.status_code))
|
print("Problem while fetching completed tasks for '" + self.name + "': " + str(r.status_code))
|
||||||
print(r.text)
|
print(r.text)
|
||||||
@ -57,7 +57,7 @@ class CrawlServer:
|
|||||||
def fetch_queued_tasks(self):
|
def fetch_queued_tasks(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(self.url + "/task/", headers=self._generate_headers(), verify=False, timeout=5)
|
r = requests.get(self.url + "/task/", headers=self._generate_headers(), verify=False, timeout=15)
|
||||||
|
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
print("Problem while fetching queued tasks for '" + self.name + "' " + str(r.status_code))
|
print("Problem while fetching queued tasks for '" + self.name + "' " + str(r.status_code))
|
||||||
@ -74,7 +74,7 @@ class CrawlServer:
|
|||||||
def fetch_current_tasks(self):
|
def fetch_current_tasks(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(self.url + "/task/current", headers=self._generate_headers(), verify=False, timeout=5)
|
r = requests.get(self.url + "/task/current", headers=self._generate_headers(), verify=False, timeout=10)
|
||||||
|
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
print("Problem while fetching current tasks for '" + self.name + "' " + str(r.status_code))
|
print("Problem while fetching current tasks for '" + self.name + "' " + str(r.status_code))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user