This message was deleted.
# general
s
This message was deleted.
w
Curious what your concern is on this? It's morally the equivalent of what's normally done in Lambda/etc. where a module is loaded which is expected to export a function. This allows ammortizing startup costs (loading and initializing Express, connecting to DBs, etc.) across multiple sequentials executions of the function - which can have significant performance implications.
a
yes this is exactly why I use it
but the whole factory thing is not the classic approach you see all the time in examples
where code that needs to run only once per container init is outside the handler
but it works really i’m just nitpicking
w
Got it - yes - it's definitely a little different style (required because Pulumi allows mixing deployment and runtime code). Though note that you can write in that style by just having a separate file and then loading it inside the
factoryFunc
.
a
yeah sure this is what I ended up with
but I’ve discovered what you’ve done for iopipe integration and that’s giving me a lot more ideas
w
🙂. That's clearly a little bit of a "hack" - and we'd love to support this style of thing in a more first-class way - but it works well in practice given how flexible JavaScript is with this sort of monkey-patching.
a
I want to PR a small thing that should improve a little bit the iopipe integration (and the possible epsagon one I’m making)
but I’m not sure it will be good
we’ll see
w
PR welcome! (and btw - I was planning on doing an Epsagon one very similar to the IOPipe one - but if you have something in progress, happy to build on top of that!)
a
Will do, and glad to add it to pulumi org if it is good enough
g
This is awesome! I know @astonishing-appointment-61804 is interested in this work as well for IOpipe.
a
Yes I am still working on my PR
w
Looking forward to it! Let us know if we can help. We made some updates to improve reliability that merged this morning in https://github.com/pulumi/pulumi-iopipe/pull/2. Thanks @adventurous-jordan-10043 for the help on that.