Comments (2)
So looks like I got to the bottom of the issue finally.
What was actually happening was that 2 separate clients for the same FileMaker file were being created and somehow they were conflicting with each other.
A little more background in case it helps anyone:
Normally you would initialize a database connection when the app first runs. Then all requests can count on that database connection being open. However, due to the FileMaker API design, in our case we need to initialize the database using fms-api-client on first request. This is because we have multiple users and we need to login to the FileMaker file with that specific username. If we were to initialize when the app started we'd have a huge number of clients initialized, one for each user. Then because we have multiple files we'd need to do a new client for each user * each file. That gets exponentially huge.
Our idea was to build Express middleware that would check the fms-api-client marpat store to see if there is a client already made for that user/database, and if not, initialize one.
// Check if this client already exists
const existingClient = await Filemaker.findOne({
name: `${user}-${database}`,
});
Conceptually it worked great, however every so often we would get a request that never finished. The issue was that if 2 request came in from the same user for the same file, it would create 2 clients. This was due to the first client not being created when the 2nd request was processed so it thought it needed to create another client.
The answer was a little complicated and required storing each client in the express app.locals
variable which would happen instantaneously. Of course it would start a promise so we needed to await any promises before allowing the request to proceed.
Anyway, if anyone is interested in the solution I could DM since we're working on a closed source project.
Hope this helps someone since it was a couple days of troubleshooting to solve!
from fms-api-client.
Hi,
I am struggeling with the same problem for a week now.
It would be great if you could help me with your solution.
What would be the best way to get in contact with you?
from fms-api-client.
Related Issues (16)
- fms-api-client - unable to verify the first certificate, local server HOT 1
- Going over concurrency doesn't throw an error but hangs
- Sessions not being reused when having multiple concurrent requests
- Invalid FileMaker Data API token when using multiple clients HOT 1
- Extremely outdated dependencies - abandoned?
- Export Utility Methods HOT 1
- Authenticate Method Response Handling HOT 1
- Unable to login/query for records HOT 6
- Possible bug HOT 6
- Opening Multiple FM Data API Sessions HOT 1
- Stale DAPI Sessions causing issues HOT 2
- Sessions aren't reused HOT 2
- Performance Question HOT 2
- Call queueing does not work HOT 3
- Browser based library? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fms-api-client.