t18-envelope-repro.mjs 1.1 KB

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