Ignore HTTPException received when closing a project

This commit is contained in:
grossmj 2026-03-17 13:23:19 +08:00
parent 0d1341b4e0
commit cb18b60c5d
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7

View File

@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import re
import os
import json
@ -30,6 +29,7 @@ import zipfile
import pathlib
from uuid import UUID, uuid4
from fastapi import HTTPException, status
from .node import Node
from .compute import ComputeError
@ -837,7 +837,11 @@ class Project:
log.warning(f"Closing project '{self.name}' ignored because it is being loaded")
return
self._closing = True
await self.stop_all()
try:
await self.stop_all()
except HTTPException as e:
if not e.status_code == status.HTTP_405_METHOD_NOT_ALLOWED:
raise
for compute in list(self._project_created_on_compute):
try:
await compute.post(f"/projects/{self._id}/close", dont_connect=True)