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

Maintenance: Centralized Value for Default IScheduler instance #862

Merged
merged 6 commits into from
Feb 22, 2024

Conversation

dwcullop
Copy link
Member

Description

Addresses #854 by defining a constant value for a default IScheduler instance and changes all instances of Scheduler.Default to use that value instead.

@dwcullop dwcullop self-assigned this Feb 20, 2024
@dwcullop dwcullop added the Housekeeping Pull requests for minor code maintenance issues label Feb 20, 2024
@dwcullop dwcullop changed the title Feature: Centralized Value for Default IScheduler instance Maintenance: Centralized Value for Default IScheduler instance Feb 20, 2024

namespace DynamicData.Internal;

internal static class Defaults
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RolandPheasant Do you think this should be a public thing so that consumers can change the value if they want to? We could call it DynamicData.GlobalConfig with this as a property or something.

It does sound like a foot-gun though. Maybe it should just be some enum that allows us to ensure it only gets set to schedulers that will work. Then again, maybe they have a reason for doing everything on the Intermediate Scheduler... Who can say?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect in this case, making it internal would probably be sufficient and it allows up to change our mind and give the consumers the best choice out of the box.

Also when I added the binding options I accidentally added the global options class in the binding namespace. That should be moved to the root namespace. It would technically be a breaking change, but I'd suggest we should not increase the bug version as it would be correcting a mistake for a bit of code for which there's probably only one or two users.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny you should ask... I just moved it to the main namespace.

Are you asking me to move the BindingOptions as part of this PR? They can't go in the same class if one is public and the other is internal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it to the main namespace and gave it a better name but kept it as internal. If you want, I can move the DynamicDataOptions as well (but it might be better as another PR).

Then later we can discuss adding a configurable Default Scheduler value to it...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RolandPheasant See #864 for those changes.


internal static class GlobalConfig
{
public static IScheduler DefaultScheduler { get; } = TaskPoolScheduler.Default;
Copy link
Member Author

@dwcullop dwcullop Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RolandPheasant This is moved / renamed version.

@dwcullop dwcullop enabled auto-merge (squash) February 20, 2024 19:32
@dwcullop dwcullop merged commit ef1e8c4 into reactivemarbles:main Feb 22, 2024
1 check passed
@dwcullop dwcullop deleted the feature/default-scheduler branch February 22, 2024 07:35
@dwcullop dwcullop linked an issue Feb 22, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Mar 8, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Housekeeping Pull requests for minor code maintenance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Performance]: Don't use Scheduler.Default as the default scheduler
3 participants