• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

First Ajax request really slow with Generator

Enthusiast ,
Apr 23, 2015 Apr 23, 2015

Copy link to clipboard

Copied

Doing simple Html panel <-> Generator plugin communication and noticed a strange issue with first Ajax call being much slower than the rest. I.e. in panel javascript the first Ajax call duration is 2000ms+ the first time and then consistently ~5ms every time. On the generator plugin side durations are <2ms every time.

I guess this could be just Chrome initializing some code, but still seems really high. Not the end of the world, but annoying anyhow. Anyone hit similar issues or any other ideas?

Generator code

_server = require("http").createServer(onServerRequest)

_server.listen(8080)


function onServerRequest (request, response) {

var start = new Date().getTime()

...

console.log("duration=" + (new Date().getTime()-start))

}

Panel javascript:

window._ajax_start = new Date().getTime()

$.ajax({ url: "http://127.0.0.1:8080/service", async: true })

  .fail(function (jqXHR, msg) { alert("service failed! message=" + msg) })

  .done(function (data) { updateData(data) })


function updateData(data)

alert("duration =" + (new Date().getTime()-window._ajax_start))

...

TOPICS
Actions and scripting

Views

452

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Apr 23, 2015 Apr 23, 2015

Copy link to clipboard

Copied

LATEST

Might be Chrome/panel init delay. If you keep Photoshop&panel open and kill & restart Generator, there is no delay. But if Generator is running, closing & opening panel gives the delay every time. In any case panel side seems to be "guilty".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines