Git Product home page Git Product logo

Comments (10)

ai avatar ai commented on June 21, 2024

Part of the works was done in #58

@chafilin can you show me links to the code, where you have problems in replacing Promise?

from server.

ai avatar ai commented on June 21, 2024

@chafilin don’t forget about tests. They are the main users of .then.

from server.

chafilin avatar chafilin commented on June 21, 2024

Part of the works was done in #58

@chafilin can you show me links to the code, where you have problems in replacing Promise?

This kind of Promises:

processing[meta.id] = new Promise((resolve, reject) => {

return new Promise((resolve, reject) => {

from server.

ai avatar ai commented on June 21, 2024

Yeap. Let’s keep Promise in those 2 examples.

I am waiting for PR to replace then in tests.

from server.

ai avatar ai commented on June 21, 2024

The current list of .then in project

➜ rg "\.then"
server-client.js
275:      .then(result => {

base-server.js
388:        .then(() => Promise.all(before))
389:        .then(keys => new Promise((resolve, reject) => {
405:    promise = promise.then(() => {
410:      promise.then(() => {
420:    return promise.then(() => {
424:    }).then(() => {
921:        }).then(access => {
960:            }).then(() => emitSubscribed())
964:        }).then(access => {

test/force-promise.test.js
4:  return forcePromise(() => Promise.resolve('result')).then(result => {
11:  return forcePromise(() => Promise.resolve().then(() => {
19:  return forcePromise(() => 'result').then(result => {

test/base-server.test.js
580:  app.destroy().then(() => {

test/stress/client.js
70:  delay(Math.random() * 10000).then(() => {

test/stress/backend.js
46:    let processing = delay(500).then(() => {
50:      processing = processing.then(() => {
52:      }).then(() => {
58:      }).then(() => {
62:      processing = processing.then(() => {
64:      }).then(() => {
68:    processing.then(() => {

Seems like we have only a few lines to close this issue.

from server.

ai avatar ai commented on June 21, 2024

a369b48
b99e4be
72f6894
6399e06
66d61c4

from server.

uncaught avatar uncaught commented on June 21, 2024

What is the reason for the forcePromise module? You can await promises and non-promises.

from server.

ai avatar ai commented on June 21, 2024

API was created before await.

Good idea to remove it. Do you want to send PR?

from server.

uncaught avatar uncaught commented on June 21, 2024

Hmm, I would, but one test fails and I don't know why.
The test reports about errors during channel authorization has this assertion:
expect(test.names).toEqual(['add', 'clean', 'error', 'add', 'clean'])
But test.names is ['add', 'error', 'add', 'clean', 'clean'] without the forcePromise.

from server.

ai avatar ai commented on June 21, 2024
  1. I forgot to say you send PR to v0.6 branch instead of master
  2. You can find reports content in test.reports. Comparing `test.reports before and after changes could help you with finding a difference. It is OK if the content is the same, but only the order was changed.
  3. If it will become too complicated you can send failing PR, I will help with tests.

from server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.