Googe Cloud Function错误:节点不可见或不是HTMLElement

时间:2020-03-29 16:39:22

标签: google-cloud-functions puppeteer

我已经使用内联编辑器编写了Google Cloud函数。我看不到哪行引发错误“节点不可见或HTML元素不可见”,我已经阅读了其他人的帖子并尝试了他们提出的解决方案。但是尚未解决问题。

有没有办法查看哪行在Google Cloud Online编辑器上引发错误? 有人可以看到此云功能有什么问题吗?

public class Queue implements Runnable{
    BlockingQueue<Client> queue;
    private int nrClients;
    private AtomicInteger waitTime;
    private boolean isClosed=true;

    public Queue(){
        nrClients= 0;
        waitTime = new AtomicInteger(0);
        queue = new LinkedBlockingQueue<Client>();
    }

    public void addClient(Client c){
        nrClients++;
        queue.add(c);
        waitTime.addAndGet(c.getServiceTime());
        c.setWaitTime(waitTime.get());
    }

    private void removeClient(Client c){
        nrClients--;
        queue.remove();
    }

    @Override
    public void run() {
            while (nrClients>0) {
                isClosed = false;
                Client c = queue.peek();
                try {
                    int mustWait = c.getServiceTime();
                    for (int i = 0; i < mustWait; i++) {
                        Thread.sleep(10);
                        c.decServiceTime();
                        waitTime.decrementAndGet();
                    }

                } catch (InterruptedException e) {
                }
                removeClient(c);
            }
            if (nrClients == 0)
                isClosed = true;
    }

    public AtomicInteger getWaitTime() {
        return waitTime;
    }

    public String toString(){
        if(nrClients==0){
            return "closed";
        }
        else
        {
            String r="";
            for(int i=0; i<nrClients; i++){
                Client c = (Client) queue.toArray()[i];
                r+="("+c.getID()+","+c.getArrivalTime()+","+c.getServiceTime()+"); ";
            }
            return r;
        }
    }

    public boolean isClosed() {
        return isClosed;
    }

0 个答案:

没有答案