package com.ss.android.ugc.aweme.services;

import X.2nK;
import X.Lea;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.services.TrafficStatisticsServiceImpl;
import java.util.LinkedHashMap;
import java.util.List;

public final class TrafficStatisticsServiceImpl$triggerUpload$3 implements Runnable {
    public final /* synthetic */ TrafficStatisticsServiceImpl this$0;

    static {
        Covode.recordClassIndex(105183);
    }

    public TrafficStatisticsServiceImpl$triggerUpload$3(TrafficStatisticsServiceImpl trafficStatisticsServiceImpl) {
        this.this$0 = trafficStatisticsServiceImpl;
    }

    public final void run() {
        this.this$0.lastUploadData = System.currentTimeMillis();
        List<TrafficStatisticsServiceImpl.TrafficData> LJIIJJI = Lea.LJIIJJI(this.this$0.getCacheQueue());
        this.this$0.getCacheQueue().clear();
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (TrafficStatisticsServiceImpl.TrafficData trafficData : LJIIJJI) {
            TrafficStatisticsServiceImpl.TrafficData trafficData2 = (TrafficStatisticsServiceImpl.TrafficData) linkedHashMap.get(trafficData.key());
            if (trafficData2 == null) {
                linkedHashMap.put(trafficData.key(), trafficData);
            } else {
                trafficData2.setDur(trafficData2.getDur() + trafficData.getDur());
                trafficData2.setLoad(trafficData2.getLoad() + trafficData.getLoad());
            }
        }
        for (TrafficStatisticsServiceImpl.TrafficData map : linkedHashMap.values()) {
            2nK.LIZ(this.this$0.EVENT_KEY, map.toMap());
        }
    }
}
