Giter VIP home page Giter VIP logo

Comments (12)

kibertoad avatar kibertoad commented on May 24, 2024 1

I will create a PR then

from fastify-request-context.

kibertoad avatar kibertoad commented on May 24, 2024

Check out the underlying library that we use, it already uses ALS when supported by used Node version.

from fastify-request-context.

Uzlopak avatar Uzlopak commented on May 24, 2024

As far as I can see if is part of node 14. So i agree, we can replace this dependency with the built in.

Can you provide a PR?

from fastify-request-context.

ankitsny avatar ankitsny commented on May 24, 2024

This is not an issue, but I struggled to integrate the AsyncLocalStorage with fastify so I am sharing the solution here.
I noticed it only work with the preHandler hook.

from fastify-request-context.

kibertoad avatar kibertoad commented on May 24, 2024

This plugin works with any lifecycle phase, and does not use the library that you mentioned.
@Uzlopak what's the minimum Node requirement for fastify 4?

from fastify-request-context.

Uzlopak avatar Uzlopak commented on May 24, 2024

node 14 is the minimum requirement.

from fastify-request-context.

voxpelli avatar voxpelli commented on May 24, 2024

I think there's a mix up between @kibertoad's asynchronous-local-storage module which is used here and the archived async-local-storage module.

The asynchronous-local-storage module uses the AsyncLocalStorage from node:async_hooks when that's enabled, else downgrades to cls-hooked.

It's probably time to drop cls-hooked in asynchronous-local-storage, but that's a separate issue for that repository I think, its only an issue for this project if that would make asynchronous-local-storage so small that it would make more sense to include it directly within this module.

from fastify-request-context.

kibertoad avatar kibertoad commented on May 24, 2024

Yeah, I was planning to do that for quite a while. PR would be welcome

from fastify-request-context.

voxpelli avatar voxpelli commented on May 24, 2024

Yeah, I was planning to do that for quite a while. PR would be welcome

@kibertoad PR for which of the two?

  1. Removing cls-hooked from asynchronous-local-storage
  2. Moving the node:async_hooks based part of asynchronous-local-storage into this module, removing asynchronous-local-storage as a separate dependency

from fastify-request-context.

kibertoad avatar kibertoad commented on May 24, 2024

The second one.

from fastify-request-context.

mcollina avatar mcollina commented on May 24, 2024

While bumping Fastify major is hard, bumping an individual package is easy. There are good reasons to bump this package major version and drop Node.js v14.

from fastify-request-context.

voxpelli avatar voxpelli commented on May 24, 2024

I'm making a PR

from fastify-request-context.

Related Issues (17)

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.