Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Singleton] and [Disable] attributes don't work #735

Closed
amitojkapoor opened this issue Nov 29, 2021 · 7 comments
Closed

[Singleton] and [Disable] attributes don't work #735

amitojkapoor opened this issue Nov 29, 2021 · 7 comments
Assignees

Comments

@amitojkapoor
Copy link

After upgrading to the new azure functions worker runtime, I noticed that both the [Singleton] and [Disable] attributes don't work.

Looks like there is a workaround for the [Disable] attribute by having a setting.

Is there a workaround for having functions be singleton?

@BenjaBobs
Copy link

This seems related to #274 .

@andrew-tevent
Copy link

And #312

@BenjaBobs
Copy link

BenjaBobs commented May 30, 2022

Any news on this?
My team made use of the singleton attribute, and it not working in out-of-proc mode is what is holding us back from upgrading.
If not a solution, then at least a work around?

@lilpug
Copy link

lilpug commented Dec 23, 2022

I'm actually quite shocked that this is still an issue, net 7 is out and people are encouraged to move to the out of process model, to utilise net 7 but the basic disable ability is still lacking.

From what i can see, the current workaround is not really suitable as although everyone keeps mentioning appsettings, which is only a fudge while your on the app service itself, this wont work locally. For local, if your using appsetting overrides correctly then being restricted to only disabling the job via local.settings.json doesnt help either.

The reason we use the disable attribute originally was to ensure for particular environments, these functions don't run. Having to modify settings on the infrastructure for each app service, everytime a new function is added to the project, which we don't want running, seems like quite an oversight.

Do we know if theres a fix or workaround yet?

I tried looking into overriding the function attribute itself to not pass the function name in if its in config but as atttributes are not really designed for DI, its tricky.

@BenjaBobs
Copy link

We managed to write our own singleton functionality (single instance though, not distributed, that would require more work) which I posted the gist of here: #938 (comment)

It's nowhere near as featureful as the old singleton attribute was, but it gets the job done.

@pzaj2
Copy link

pzaj2 commented Jun 15, 2023

Hi everyone,

I just wanted to ask if there's a place where one could track progress (or lack thereof) around this issue. With WebJobs 3.x not allowing manual job function execution, I'd like to migrate to a function app. I do, however, have a couple of functions that must remain singletons.

Thanks in advance.

@brettsam
Copy link
Member

Closing as dupe of #312 (it also mentions Singleton)

@brettsam brettsam closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants