quickfix: delete seedfile after the workflow has been deleted (#2763)
Since seedfile deletion checks that the seedfile is not used in any workflow, it should be deleted after the workflow is removed. noticed in checking #2744
This commit is contained in:
parent
309977f7e5
commit
89027ef16e
@ -976,14 +976,6 @@ class CrawlConfigOps:
|
|||||||
|
|
||||||
# if no crawls have been run, actually delete
|
# if no crawls have been run, actually delete
|
||||||
if not crawlconfig.crawlAttemptCount:
|
if not crawlconfig.crawlAttemptCount:
|
||||||
if crawlconfig.config and crawlconfig.config.seedFileId:
|
|
||||||
try:
|
|
||||||
await self.file_ops.delete_seed_file(
|
|
||||||
crawlconfig.config.seedFileId, org
|
|
||||||
)
|
|
||||||
except HTTPException:
|
|
||||||
pass
|
|
||||||
|
|
||||||
result = await self.crawl_configs.delete_one(
|
result = await self.crawl_configs.delete_one(
|
||||||
{"_id": crawlconfig.id, "oid": crawlconfig.oid}
|
{"_id": crawlconfig.id, "oid": crawlconfig.oid}
|
||||||
)
|
)
|
||||||
@ -991,6 +983,14 @@ class CrawlConfigOps:
|
|||||||
if result.deleted_count != 1:
|
if result.deleted_count != 1:
|
||||||
raise HTTPException(status_code=404, detail="failed_to_delete")
|
raise HTTPException(status_code=404, detail="failed_to_delete")
|
||||||
|
|
||||||
|
if crawlconfig and crawlconfig.config.seedFileId:
|
||||||
|
try:
|
||||||
|
await self.file_ops.delete_seed_file(
|
||||||
|
crawlconfig.config.seedFileId, org
|
||||||
|
)
|
||||||
|
except HTTPException:
|
||||||
|
pass
|
||||||
|
|
||||||
status = "deleted"
|
status = "deleted"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -181,7 +181,11 @@ def test_stop_crawl_partial(
|
|||||||
def test_crawl_with_hostname(default_org_id, crawler_auth_headers):
|
def test_crawl_with_hostname(default_org_id, crawler_auth_headers):
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_PREFIX}/orgs/{default_org_id}/crawls/{crawl_id}/replay.json",
|
f"{API_PREFIX}/orgs/{default_org_id}/crawls/{crawl_id}/replay.json",
|
||||||
headers={"X-Forwarded-Proto": "https", "host": "custom-domain.example.com", **crawler_auth_headers},
|
headers={
|
||||||
|
"X-Forwarded-Proto": "https",
|
||||||
|
"host": "custom-domain.example.com",
|
||||||
|
**crawler_auth_headers,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert r.json()["pagesQueryUrl"].startswith("https://custom-domain.example.com/")
|
assert r.json()["pagesQueryUrl"].startswith("https://custom-domain.example.com/")
|
||||||
|
Loading…
Reference in New Issue
Block a user