mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-08 14:02:55 +00:00
Retry on 423 error "snapshot is in transition"
This commit is contained in:
@@ -66,6 +66,7 @@ class NeonAPI:
|
||||
elif resp.status_code == 423 and resp.json()["message"] in {
|
||||
"endpoint is in some transitive state, could not suspend",
|
||||
"project already has running conflicting operations, scheduling of new ones is prohibited",
|
||||
"snapshot is in transition"
|
||||
}:
|
||||
retry = True
|
||||
self.retries4xx += 1
|
||||
|
||||
@@ -463,7 +463,7 @@ class NeonProject:
|
||||
Two optional arguments: lsn and timestamp are mutually exclusive
|
||||
they instruct to create a snapshot with the specific lns or timestamp
|
||||
"""
|
||||
return NeonSnapshot(
|
||||
snapshot = NeonSnapshot(
|
||||
self,
|
||||
self.neon_api.create_snapshot(
|
||||
self.id,
|
||||
@@ -473,6 +473,8 @@ class NeonProject:
|
||||
self.gen_snapshot_name(),
|
||||
),
|
||||
)
|
||||
self.wait()
|
||||
return snapshot
|
||||
|
||||
def delete_snapshot(self, snapshot_id: str) -> None:
|
||||
"""
|
||||
@@ -480,6 +482,7 @@ class NeonProject:
|
||||
"""
|
||||
self.neon_api.delete_snapshot(self.id, snapshot_id)
|
||||
self.snapshots.pop(snapshot_id)
|
||||
self.wait()
|
||||
|
||||
def restore_snapshot(self, snapshot_id: str) -> NeonBranch | None:
|
||||
"""
|
||||
@@ -496,6 +499,7 @@ class NeonProject:
|
||||
self.generate_branch_name(),
|
||||
)
|
||||
target_branch.start_benchmark()
|
||||
self.wait()
|
||||
return target_branch
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user