Montify: allow restarting stuck sync from UI; log sync progress

This commit is contained in:
2026-10-10 17:11:51 +03:30
parent 0802c2f436
commit 792b3d29fa
2 changed files with 10 additions and 2 deletions
@@ -236,9 +236,13 @@ export class MontifySyncService {
: undefined;
let page = 1;
let lastPage = 1;
this.logger.log(`Montify sync ${row.id} (${row.label}) start ${mode}${updatedAfter ? ` after ${updatedAfter}` : ''}`);
do {
const res = await client.listCustomers({ page, limit: CUSTOMER_PAGE_SIZE, updatedAfter });
lastPage = res.meta.last_page;
this.logger.log(
`Montify sync ${row.id} page ${page}/${lastPage}: ${res.data.length} customers (total ${res.meta.total})`,
);
for (const customer of res.data) {
result.customersFetched += 1;
try {
@@ -276,6 +280,10 @@ export class MontifySyncService {
);
result.finishedAt = new Date().toISOString();
result.errors = [...missing, ...result.errors].slice(0, 50);
this.logger.log(
`Montify sync ${row.id} done: ${result.customersFetched} customers, ${result.ordersFetched} orders, ` +
`${result.transactionsFetched} transactions, ${result.errors.length} errors${fatal ? ` — fatal: ${fatal}` : ''}`,
);
await this.prisma.montifyConnection.update({
where: { id: row.id },
data: {
+2 -2
View File
@@ -321,7 +321,7 @@ onBeforeUnmount(() => {
</UiButton>
<UiButton
size="sm"
:disabled="!c.enabled || c.syncStatus === 'running'"
:disabled="!c.enabled"
@click="sync(c, 'incremental')"
>
همگام‌سازی
@@ -329,7 +329,7 @@ onBeforeUnmount(() => {
<UiButton
size="sm"
variant="secondary"
:disabled="!c.enabled || c.syncStatus === 'running'"
:disabled="!c.enabled"
@click="sync(c, 'full')"
>
همگام‌سازی کامل