8000 Going over concurrency doesn't throw an error but hangs · Issue #107 · Luidog/fms-api-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Going over concurrency doesn't throw an error but hangs #107
Open
@jeremydrichardson

Description

@jeremydrichardson

Describe the bug
I'm trying to make 3 concurrent calls with the same client. As soon as I add the third request it hangs and never returns a response.

Expected behavior
I'd like to better understand the concurrency setting and its expected behavior. I would expect it to throw an error when there aren't enough connections and the call fails. Part of the issue may be that my lambda is timing out before fms-api-client is able to get a response. However, I've raised the timeout quite high and it doesn't seem to change anything. Whereas if I up the concurrency to 6, it works just fine. Just don't want to run into issue where I run out of connection and it fails and there is no error to tell me what is happening.

Code Examples


async function getFmsApiClient(database) {
  const fmsApiClient = Filemaker.create({
    name: `client-${database}`,
    database: database,
    concurrency: 3,
    server: `${process.env.SERVER}`,
    user: `${process.env.USER}`,
    password: `${process.env.PASSWORD}`,
    usage: true,
    timeout: 20000,
  });
  await fmsApiClient.save();

  return fmsApiClient;
}

app.use(async (req, res, next) => {
  await connect("nedb://memory");
  next();
});

router.get("/config/test", async function (req, res, next) {
  const client = await getFmsApiClient("DATABASENAME");

  const getCodes = (layout, listName) => {
    return client
      .find(encodeURI(layout), [{ z_SYS_List_Type_t: listName }])
      .catch((err) => {
        throw new Error(err);
      });
  };

  const codes = await Promise.all([
    getCodes("[LIST] Programming Type", "[SYS] Programming List").catch((err) =>
      console.log(err)
    ),
    getCodes("[LIST] Promo Code Letter", "Promo Code Letter").catch((err) =>
      console.log(err)
    ),
    getCodes("[LIST] Promo Spot Type", "Spot Type List").catch((err) =>
      console.log(err)
    ),
  ]).catch((err) => console.error(err.message));

  res.json({ codes: codes });
});

We're using Express to build an API in front of our FileMaker app. Created the getFmsApiClient to make it easy to create new clients for each file we need to access (it's a large multi-file solution).

Using getCodes to make the find easy and return a promise that should be resolved in the promise.all.

I'm still struggling to understand how marpat works and how the client system works which is making it difficult to debug this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0