Skip to content

Commit

Permalink
Merge pull request #1173 from threefoldtech/development_proxy_seriali…
Browse files Browse the repository at this point in the history
…zation_failure

lock cache row to prevent concurrent updates
  • Loading branch information
Omarabdul3ziz authored Sep 1, 2024
2 parents 7a9b33c + 603a57a commit 306b28e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 7 additions & 3 deletions grid-proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ Check `/version` on any instance to know the version.

### 3.13

---
## Releases

- include releases from v0.13.5 to v0.14.11
### v0.15.12

## Releases
---

- `fix` serialization_failure due to concurrent update
- `feat` include gpu cards in the node response
- `feat` use proper level logging

### v0.15.11

Expand Down
2 changes: 1 addition & 1 deletion grid-proxy/charts/gridproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ version: 1.0.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.15.11
appVersion: 0.15.12

# make sure to update the changelog with the changes in this release
8 changes: 7 additions & 1 deletion grid-proxy/internal/explorer/db/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ $$
BEGIN
IF (TG_OP = 'UPDATE' AND NEW.state = 'Deleted') THEN
BEGIN
-- lock cache row to prevent concurrent updates
PERFORM 1
FROM resources_cache
WHERE node_id = NEW.node_id
FOR UPDATE;

UPDATE resources_cache
SET
used_cru = resources_cache.used_cru - contract_resources.cru,
Expand Down Expand Up @@ -639,7 +645,7 @@ BEGIN

total_ips = total_ips + (
CASE
WHEN TG_OP = 'INSERT'
WHEN TG_OP = 'INSERT'
THEN 1
WHEn TG_OP = 'DELETE'
THEN -1
Expand Down

0 comments on commit 306b28e

Please sign in to comment.