fix: harden real backend workflows and channel connections

This commit is contained in:
hectorzhao
2026-07-06 17:54:53 +08:00
parent 8cca361441
commit b5132d7f4e
47 changed files with 2530 additions and 314 deletions
@@ -33,7 +33,7 @@ function createPrismaMock() {
carrier: 'mobile',
sendRegion: '全国',
config: { serviceId: 'SMS' },
connectionStates: [{ status: 'online', currentConnections: 1, desiredConnections: 1 }],
connectionStates: [{ status: 'connected', currentConnections: 1, desiredConnections: 1 }],
};
const route = {
id: 'route-1',
@@ -485,7 +485,7 @@ describe('SendChainService', () => {
status: 'active',
carrier: 'all',
sendRegion: '全国',
connectionStates: [{ status: 'online', currentConnections: 1, desiredConnections: 1 }],
connectionStates: [{ status: 'connected', currentConnections: 1, desiredConnections: 1 }],
},
},
{
@@ -505,7 +505,7 @@ describe('SendChainService', () => {
status: 'active',
carrier: 'all',
sendRegion: '全国',
connectionStates: [{ status: 'online', currentConnections: 1, desiredConnections: 1 }],
connectionStates: [{ status: 'connected', currentConnections: 1, desiredConnections: 1 }],
},
},
],
+1 -1
View File
@@ -863,7 +863,7 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
return false;
}
return (channel.connectionStates ?? []).some((connection) =>
connection.desiredConnections > 0 && connection.currentConnections > 0 && ['online', 'connected'].includes(connection.status),
connection.desiredConnections > 0 && connection.currentConnections > 0 && connection.status === 'connected',
);
}