Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

chore: housekeeping in session service and dashboard styles

Yudhi Armyndharise14087fae7ee
diff --git a/dashboard/src/pages/Templates.css b/dashboard/src/pages/Templates.css
index 4936bfa21..302be214f 100644
--- a/dashboard/src/pages/Templates.css
+++ b/dashboard/src/pages/Templates.css
@@ -391,50 +391,6 @@
color: var(--error);
}
-.templates-page .toast {
- position: fixed;
- top: 1.5rem;
- right: 1.5rem;
- z-index: 1000;
- display: flex;
- align-items: center;
- gap: 0.75rem;
- padding: 1rem 1.25rem;
- border-radius: 8px;
- box-shadow: var(--shadow-lg);
- font-size: 0.875rem;
- font-weight: 500;
-}
-
-.templates-page .toast.success {
- border: 1px solid rgba(37, 211, 102, 0.3);
- background: rgba(37, 211, 102, 0.12);
- color: var(--success);
-}
-
-.templates-page .toast.error {
- border: 1px solid rgba(239, 68, 68, 0.3);
- background: rgba(239, 68, 68, 0.12);
- color: var(--error);
-}
-
-.templates-page .toast-close {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 28px;
- height: 28px;
- padding: 0;
- border: 0;
- background: transparent;
- color: inherit;
- opacity: 0.7;
-}
-
-.templates-page .toast-close:hover {
- opacity: 1;
-}
-
@media (max-width: 1280px) {
.templates-page .templates-workspace {
grid-template-columns: 280px minmax(380px, 1fr);
diff --git a/dashboard/src/pages/Webhooks.css b/dashboard/src/pages/Webhooks.css
index 966bb622a..6fa5bf5f3 100644
--- a/dashboard/src/pages/Webhooks.css
+++ b/dashboard/src/pages/Webhooks.css
@@ -522,59 +522,6 @@
}
}
-/* Toast Notification */
-.webhooks-page .toast {
- position: fixed;
- top: 1.5rem;
- right: 1.5rem;
- display: flex;
- align-items: center;
- gap: 0.75rem;
- padding: 1rem 1.25rem;
- border-radius: 10px;
- font-size: 0.875rem;
- font-weight: 500;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
- z-index: 1000;
- animation: slideIn 0.3s ease;
-}
-
-@keyframes slideIn {
- from {
- transform: translateX(100%);
- opacity: 0;
- }
- to {
- transform: translateX(0);
- opacity: 1;
- }
-}
-
-.webhooks-page .toast.success {
- background: rgba(37, 211, 102, 0.12);
- border: 1px solid rgba(37, 211, 102, 0.3);
- color: var(--success);
-}
-
-.webhooks-page .toast.error {
- background: rgba(239, 68, 68, 0.12);
- border: 1px solid rgba(239, 68, 68, 0.3);
- color: var(--error);
-}
-
-.webhooks-page .toast-close {
- background: transparent;
- border: none;
- padding: 0.25rem;
- cursor: pointer;
- opacity: 0.6;
- color: inherit;
-}
-
-.webhooks-page .toast-close:hover {
- opacity: 1;
-}
-
/* Danger Button */
/* Small Modal Variant */
.webhooks-page .modal.modal-sm {
diff --git a/src/engine/identity/lid-mapping-store.service.ts b/src/engine/identity/lid-mapping-store.service.ts
index afea570d7..48e18e436 100644
--- a/src/engine/identity/lid-mapping-store.service.ts
+++ b/src/engine/identity/lid-mapping-store.service.ts
@@ -6,7 +6,7 @@ import { userPart } from './wa-id';
import { createLogger } from '../../common/services/logger.service';
import { resolveNonNegativeIntEnv } from '../../config/configuration';
-// Default cap on the in-memory lid->phone mirror. Every other long-lived map in the audited surface is
+// Default cap on the in-memory lid->phone mirror. Every other long-lived map in the engine surface is
// bounded (the per-session lidPhoneCache is 5000); the LID mirror was the lone exception. A miss falls
// back to engine re-resolution, so the cap trades a re-resolution for bounded memory, never data loss.
export const LID_MAPPING_CACHE_DEFAULT = 5000;
diff --git a/src/modules/session/session.service.spec.ts b/src/modules/session/session.service.spec.ts
index 4c23e6911..a5826b0e4 100644
--- a/src/modules/session/session.service.spec.ts
+++ b/src/modules/session/session.service.spec.ts
@@ -13,7 +13,7 @@ import {
HttpStatus,
} from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
-import { SessionService } from './session.service';
+import { SessionService, AUTOSTART_THROTTLE_MS } from './session.service';
import { ACK_RECONCILE_DELAY_MS } from './message-projector.service';
import { SessionEngineLifecycle } from './session-engine-lifecycle.service';
import { Session, SessionStatus } from './entities/session.entity';
@@ -5737,7 +5737,7 @@ describe('SessionService', () => {
jest.useFakeTimers();
try {
service.onApplicationBootstrap();
- await jest.advanceTimersByTimeAsync(2_000); // the inter-launch throttle
+ await jest.advanceTimersByTimeAsync(AUTOSTART_THROTTLE_MS); // the inter-launch throttle
await autoStartRun();
expect(startSpy).toHaveBeenCalledTimes(2);
@@ -5762,7 +5762,7 @@ describe('SessionService', () => {
jest.useFakeTimers();
try {
service.onApplicationBootstrap();
- await jest.advanceTimersByTimeAsync(2_000); // the inter-launch throttle
+ await jest.advanceTimersByTimeAsync(AUTOSTART_THROTTLE_MS); // the inter-launch throttle
await autoStartRun();
expect(startSpy).toHaveBeenCalledTimes(2);
@@ -5808,7 +5808,7 @@ describe('SessionService', () => {
jest.useFakeTimers();
try {
service.onApplicationBootstrap();
- await jest.advanceTimersByTimeAsync(2_000); // the inter-launch throttle
+ await jest.advanceTimersByTimeAsync(AUTOSTART_THROTTLE_MS); // the inter-launch throttle
await autoStartRun();
expect(startSpy).toHaveBeenCalledTimes(1);
diff --git a/src/modules/session/session.service.ts b/src/modules/session/session.service.ts
index f495da284..a6a68b9ab 100644
--- a/src/modules/session/session.service.ts
+++ b/src/modules/session/session.service.ts
@@ -29,6 +29,9 @@ import { IWhatsAppEngine, ChatSummary, ChatState } from '../../engine/interfaces
import { createLogger } from '../../common/services/logger.service';
import { HookManager } from '../../core/hooks';
+/** Pause between sequential auto-start launches so a burst of Chromium boots does not spike the host. */
+export const AUTOSTART_THROTTLE_MS = 2_000;
+
/**
* The session-record API: CRUD over the sessions table, aggregate stats, and the thin engine query
* proxies (QR/pairing/chats/groups/chat-state) behind the controller routes. Every engine LIFECYCLE
@@ -192,7 +195,7 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicat
}
// Throttle between sequential Chromium launches; no need to wait after the last one.
if (i < sessions.length - 1) {
- await setTimeout(2000);
+ await setTimeout(AUTOSTART_THROTTLE_MS);
}
}
}