mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Isolate infinite loop bug, add timeout to actions (#583)
* Isolate infinite loop bug, add timeout to actions * Increase timeout to allow for temporary failure * Set correct timeout, implement temporary fix * Trigger syncs at controller layer
This commit is contained in:
parent
2d406274ac
commit
b1bfdef8ff
7 changed files with 36 additions and 20 deletions
|
@ -7,6 +7,8 @@ class ValuationsController < ApplicationController
|
|||
# TODO: placeholder logic until we have a better abstraction for trends
|
||||
@valuation = @account.valuations.new(valuation_params.merge(currency: Current.family.currency))
|
||||
if @valuation.save
|
||||
@valuation.account.sync_later
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to account_path(@account), notice: "Valuation created" }
|
||||
format.turbo_stream
|
||||
|
@ -30,6 +32,8 @@ class ValuationsController < ApplicationController
|
|||
def update
|
||||
@valuation = Valuation.find(params[:id])
|
||||
if @valuation.update(valuation_params)
|
||||
@valuation.account.sync_later
|
||||
|
||||
redirect_to account_path(@valuation.account), notice: "Valuation updated"
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
|
@ -42,7 +46,8 @@ class ValuationsController < ApplicationController
|
|||
def destroy
|
||||
@valuation = Valuation.find(params[:id])
|
||||
@account = @valuation.account
|
||||
@valuation.destroy
|
||||
@valuation.destroy!
|
||||
@account.sync_later
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to account_path(@account), notice: "Valuation deleted" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue