Dart HttpRequest Poll

I have a web application with a timer that runs a poll to receive data every 3 seconds. It works fine for about 2.5 minutes, after which chromium fails.

My Dart request is as follows

HttpRequest.getString('data/get_load_history_recent.json')
  .then((e) => _recentHistoryResponse(e))
  .catchError((e) => _recentHistoryError(e));

Can you come up with any reasons why this will happen? I guess this is a memory leak ...

Edit: Here is my_recentHistoryResponse()

void _recentHistoryResponse(String data)
{
  Map obj = JSON.decode(data);
  if(obj['status'] == 'success')
  {
    List processes = obj['data']['processes'];
    List newItems = new List();

    List oldIdsArray = new List();

    int length = appDataDic.load_history_list.length;
    for(HistoryDataVO oldVO in appDataDic.load_history_list)
    {
      oldIdsArray.add(oldVO.loadID);
    }

    for(Map process in processes)
    {
      HistoryDataVO dataVO = new HistoryDataVO(); 
      dataVO.loadID = process['loadID'];
      dataVO.time = process['time'];
      dataVO.loadType = process['loadType'];
      dataVO.fileName = process['fileName'];
      dataVO.label = process['label'];
      dataVO.description = process['description'];
      dataVO.count = process['count'];
      dataVO.progress = process['progress'];
      dataVO.loadTask = process['loadTask'];

      // Check if the item is currently in the list
      if(length >= 1)
      {
        if(!LoadHistoryHelper.exists(oldIdsArray, dataVO.loadID))
        {
          dataVO.isNew = true;
        }
      }

      newItems.add(dataVO);
    }

    appDataDic.load_history_list.clear();
    appDataDic.load_history_list.addAll(newItems);

  }
}

I commented on the existing check !LoadHistoryHelper.exists(oldIdsArray, dataVO.loadID))(because it seemed like an obvious place), but it still crashes.

In addition, I took the same code and put it in an isolated application, the only real difference in the polling check is that it appDataDic.load_history_listis simple @observable List, not ObservableList.

2: , , Map obj = JSON.decode(data); . Javascript, ( , ), ? - ? ? .

+4
1

, HttpRequest; - Dart. , , , .

0

All Articles