Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await Table.size() doesn't return up-to-date results? #972

Closed
andyferris opened this issue Mar 12, 2020 · 1 comment
Closed

await Table.size() doesn't return up-to-date results? #972

andyferris opened this issue Mar 12, 2020 · 1 comment
Assignees
Labels
JS question Questions about use, potential features, or improvements

Comments

@andyferris
Copy link

andyferris commented Mar 12, 2020

Bug Report

Steps to Reproduce:

  1. Create table: Table in node.js with a schema and index via const table = perspective.table(schema, { index }).
  2. Call await table.update(rows) where n = rows.length.
  3. Next call const m = await table.size() and compare n to m.

Expected Result:

I expected the result of await table.size() to reflect the change from the previous call to await table.update().

Actual Result:

It seems to sometimes return the size from before the execution of the update (i.e. m = 0). Here is some example logging:

INFO	[1]	Perspective updated data in table XXX with 251 new rows, leaving a total of 0 rows

where n = 251 and m = 0. The rows exist in the table and are visible in the UI.

Environment:

Using Node.js 12.x, Perspective 0.4.5, Typescript 3.8.3, running on linux (typically inside docker).

Additional Context:

I am trying to keep an up-to-date count of the number of rows in each of the tables. We have many tables and users may select one in the UI, upon which the client will connect to the table via websocket. However it would be convenient to know the size of the tables (particularly e.g. if they are empty) before selecting it, without having to create a connection to each and every table. Thus we are attempting to have the node.js backend track this seperately after each data update.

@timkpaine timkpaine added JS question Questions about use, potential features, or improvements labels Mar 14, 2020
@sc1f
Copy link
Contributor

sc1f commented Mar 17, 2020

This issue was fixed in PR #961, and should be in the latest 0.4.6 release of Perspective. I have added a test for this issue on a separate branch to prevent regression as well.

Thanks for the report!

@sc1f sc1f closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS question Questions about use, potential features, or improvements
Projects
None yet
Development

No branches or pull requests

3 participants