mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-24 15:19:32 +01:00
Check whether the browser supports performance.measure/mark before calling them. Fixes https://github.com/cmdr2/stable-diffusion-ui/pull/757
This commit is contained in:
parent
64ced3b3f6
commit
a17a9044ad
@ -839,10 +839,13 @@
|
|||||||
* @memberof Task
|
* @memberof Task
|
||||||
*/
|
*/
|
||||||
async post(timeout=-1) {
|
async post(timeout=-1) {
|
||||||
|
if (typeof performance == "object" && performance.mark && performance.measure) {
|
||||||
performance.mark('make-render-request')
|
performance.mark('make-render-request')
|
||||||
if (performance.getEntriesByName('click-makeImage', 'mark').length > 0) {
|
if (performance.getEntriesByName('click-makeImage', 'mark').length > 0) {
|
||||||
console.log('delay between clicking and making the server request:', performance.measure('diff', 'click-makeImage', 'make-render-request').duration + ' ms')
|
console.log('delay between clicking and making the server request:', performance.measure('diff', 'click-makeImage', 'make-render-request').duration + ' ms')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let jsonResponse = await super.post('/render', timeout)
|
let jsonResponse = await super.post('/render', timeout)
|
||||||
if (typeof jsonResponse?.task !== 'number') {
|
if (typeof jsonResponse?.task !== 'number') {
|
||||||
console.warn('Endpoint error response: ', jsonResponse)
|
console.warn('Endpoint error response: ', jsonResponse)
|
||||||
|
@ -429,7 +429,10 @@ function getUncompletedTaskEntries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeImage() {
|
function makeImage() {
|
||||||
|
if (typeof performance == "object" && performance.mark) {
|
||||||
performance.mark('click-makeImage')
|
performance.mark('click-makeImage')
|
||||||
|
}
|
||||||
|
|
||||||
if (!SD.isServerAvailable()) {
|
if (!SD.isServerAvailable()) {
|
||||||
alert('The server is not available.')
|
alert('The server is not available.')
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user