| 12345678910111213141516171819202122232425262728 |
- import { fetchBaseArchives } from '../../../src/modules/cockpit/services/infrastructureApi.js'
- import { fetchCurrentEvents } from '../../../src/modules/cockpit/services/eventApi.js'
- const base = 'http://192.168.110.96:8301/api/cockpit/v1'
- const config = { dataSource: 'real', api: { baseUrl: base } }
- async function probe(tag) {
- const s = await fetchBaseArchives({ config })
- console.log(tag, JSON.stringify({ state: s.state, facilityCount: s.data && s.data.facilityCount, reason: s.reason }))
- return s
- }
- await probe('A_单独首次:')
- // 复现 audit 脚本里在 123 次请求之后才调用适配器的情况
- await fetch('http://192.168.110.96:8301/api/cockpit/v1/map-snapshot?pageSize=1000')
- await probe('B_一次raw请求后:')
- const events = await fetchCurrentEvents({ config, mode: 'ALARM' })
- console.log('C_events(后端code=500):', JSON.stringify({ state: events.state, reason: events.reason }))
- for (let i = 0; i < 20; i += 1) {
- await fetch(base + '/infrastructure/base-archives')
- }
- await probe('D_多次同类请求后:')
- await fetch(base + '/events/current?mode=ALARM')
- await probe('E_先读业务500再读适配器:')
|