Zendro-dev / graphql-server

Skeleton NodeJS project for a graphQL server.
GNU General Public License v3.0
0 stars 1 forks source link

Fix the CSV Export to use CursorBasedPagination #35

Open asishallab opened 4 years ago

asishallab commented 4 years ago

Currently our CSV Export of all records works by invoking <DataModelName>s resolvers in an iterative manner. All retrieved records are written into a response stream. This needs to be changed to the usage of Cursor-Based-Pagination <DataModelName>Connection in order to make distributed data models work with this. The reason is that in case of DDMs limit-offset based pagination cannot be implemented.

Adjust the procedure so that the cursor is always set to the last record received from the last iteration, or null, if it is the first iteration. Repeat until pageInfo.hasNextPage is false.

Add a general customizable timeout to it. In globals add a new constant exportTimeoutSeconds which can be set in the environment, too. The default value should be one hour (3600). The user of the cenzontle code generators can set it as liked. If the timeout is reached a respective error is thrown and returned to the user. The stream of course is interrupted.

Add an integration test to verify the export works. The timeout can but must not necessarily be tested.