mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Adjust delays for observers
This commit is contained in:
parent
7c3613455d
commit
aeae0a19ab
@ -55,7 +55,7 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping();
|
||||
|
||||
$schedule->job(new LedgerBalanceUpdate)->everyFiveMinutes()->withoutOverlapping();
|
||||
// $schedule->job(new LedgerBalanceUpdate)->everyFiveMinutes()->withoutOverlapping();
|
||||
|
||||
$schedule->job(new CompanySizeCheck)->daily()->withoutOverlapping();
|
||||
|
||||
|
@ -104,7 +104,7 @@ class StorePaymentRequest extends Request
|
||||
'credits.*.credit_id' => new ValidCreditsRules($this->all()),
|
||||
'credits.*.amount' => ['required', new CreditsSumRule($this->all())],
|
||||
'invoices' => new ValidPayableInvoicesRule(),
|
||||
'number' => ['nullable', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
|
||||
'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
|
||||
|
||||
];
|
||||
|
||||
|
@ -177,6 +177,8 @@ class InvoiceEmailEngine extends BaseEmailEngine
|
||||
});
|
||||
}
|
||||
|
||||
$task_ids = [];
|
||||
|
||||
if(property_exists($item, 'task_id'))
|
||||
{
|
||||
$task_ids[] = $item->task_id;
|
||||
|
@ -48,4 +48,9 @@ class CompanyLedger extends Model
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo(Client::class);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class ClientObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ class ClientObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CLIENT, $client, $client->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CLIENT, $client, $client->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class ClientObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_CLIENT, $client, $client->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_CLIENT, $client, $client->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class ExpenseObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ class ExpenseObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_EXPENSE, $expense, $expense->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class ExpenseObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_EXPENSE, $expense, $expense->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class InvoiceObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class InvoiceObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(2));
|
||||
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class InvoiceObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_INVOICE, $invoice, $invoice->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class PaymentObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(5);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class PaymentObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(5);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ProjectObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
|
||||
WebhookHandler::dispatch(Webhook::EVENT_PROJECT_CREATE, $project, $project->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_PROJECT_CREATE, $project, $project->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class ProjectObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
|
||||
WebhookHandler::dispatch(Webhook::EVENT_PROJECT_UPDATE, $project, $project->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_PROJECT_UPDATE, $project, $project->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class QuoteObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
$quote->load('client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ class QuoteObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
$quote->load('client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
|
||||
}
|
||||
@ -72,7 +72,7 @@ class QuoteObserver
|
||||
|
||||
if ($subscriptions) {
|
||||
$quote->load('client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company, 'client');
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class TaskObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ class TaskObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_TASK, $task, $task->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_TASK, $task, $task->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class TaskObserver
|
||||
->exists();
|
||||
|
||||
if ($subscriptions) {
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_TASK, $task, $task->company);
|
||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_TASK, $task, $task->company)->delay(now()->addSeconds(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,7 +568,7 @@ class StripePaymentDriver extends BaseDriver
|
||||
|
||||
//payment_intent.succeeded - this will confirm or cancel the payment
|
||||
if($request->type === 'payment_intent.succeeded'){
|
||||
PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(10);
|
||||
PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(10));
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class LedgerService
|
||||
|
||||
$this->entity->company_ledger()->save($company_ledger);
|
||||
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(300);
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(now()->addSeconds(300));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -54,7 +54,7 @@ class LedgerService
|
||||
|
||||
$this->entity->company_ledger()->save($company_ledger);
|
||||
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(300);
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(now()->addSeconds(300));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -71,7 +71,7 @@ class LedgerService
|
||||
|
||||
$this->entity->company_ledger()->save($company_ledger);
|
||||
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(300);
|
||||
ClientLedgerBalanceUpdate::dispatch($this->entity->company, $this->entity->client)->delay(now()->addSeconds(300));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user