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:
Ilya Kreymer 2025-07-23 20:10:29 -07:00 committed by GitHub
parent 309977f7e5
commit 89027ef16e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -976,14 +976,6 @@ class CrawlConfigOps:
# if no crawls have been run, actually delete
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(
{"_id": crawlconfig.id, "oid": crawlconfig.oid}
)
@ -991,6 +983,14 @@ class CrawlConfigOps:
if result.deleted_count != 1:
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"
else:

View File

@ -181,7 +181,11 @@ def test_stop_crawl_partial(
def test_crawl_with_hostname(default_org_id, crawler_auth_headers):
r = requests.get(
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.json()["pagesQueryUrl"].startswith("https://custom-domain.example.com/")