GithubHelp home page GithubHelp logo

Comments (9)

Jikoo avatar Jikoo commented on August 15, 2024 1

Migrating on the main thread is a great way to get shut down by the watchdog while transferring larger data sets. Perhaps instead the current provider should be set to a dummy economy that always returns FAILURE? That way not only do you not risk the server killing itself due to the main thread lockup, players can still play using non-economic features while the economy is being migrated.

from treasury.

MrNemo64 avatar MrNemo64 commented on August 15, 2024

We propably want to do all the migration on the main thread, If we do it async some plugin may use the old economy provider while switching.
If a plugin is already fetching async we should probably block untill we finish (dont know how).
What do you think of EconomyProviderMigrationStartEvent and EconomyProviderMigrationFinishEvent

from treasury.

lokka30 avatar lokka30 commented on August 15, 2024

We propably want to do all the migration on the main thread, If we do it async some plugin may use the old economy provider while switching. If a plugin is already fetching async we should probably block untill we finish (dont know how). What do you think of EconomyProviderMigrationStartEvent and EconomyProviderMigrationFinishEvent

I think it should be done on the main thread, and if possible, block the async threads too.

What plans do you have for the new events? I don't see an issue in creating them but I don't know what they are used for :)

from treasury.

MrNemo64 avatar MrNemo64 commented on August 15, 2024

What plans do you have for the new events? I don't see an issue in creating them but I don't know what they are used for :)

I don't know, maybe some plugin find it useful

I think it should be done on the main thread, and if possible, block the async threads too.

Blocking on async threads, if an operation is being made, it may start with currency A and end with B, dont know how many problems that can cause. Maybe post this on the spigot thread an see ideas

from treasury.

Geolykt avatar Geolykt commented on August 15, 2024

It's best if we rip out that code in the meantime so we have something that compiles and people can link to

from treasury.

MrNemo64 avatar MrNemo64 commented on August 15, 2024

Migrating on the main thread is a great way to get shut down by the watchdog while transferring larger data sets. Perhaps instead the current provider should be set to a dummy economy that always returns FAILURE? That way not only do you not risk the server killing itself due to the main thread lockup, players can still play using non-economic features while the economy is being migrated.

I like this idea. Maybe even add a isMigratingEconomyProvider so that we can check? But how would we handle operations that already started?

from treasury.

Jikoo avatar Jikoo commented on August 15, 2024

Maybe even add a isMigratingEconomyProvider so that we can check?

I assume if you wanted to check you could check the implementing class. I guess you could include it as part of the API, but it seems like a very particular use thing that I'm not sure belongs. Your average plugin shouldn't care, they'll just see that the transaction fails and that's that. It's such a rare case too, I sincerely doubt you'd be converting more than maybe once a year if you happen to have particularly bad luck with economy providers.

But how would we handle operations that already started?

Probably would need some sort of EconomyProvider#awaitPendingQueries, but this also overall seems like one of those overkill situations - even the slowest of response times is unlikely to exceed a second, so what are the odds that someone started a transaction that will coincide with your once-per-year economy migration? Additionally, bad actors who just grab and hang onto the first available EconomyProvider instead of reobtaining it as necessary can still create new queries using the old economy instance unless the provider actually verifies that it's still registered every single time it's used.

Speaking of I need to go back and change my RegisteredServiceProvider usage for Vault integrations to listen to the ServiceRegisterEvent and ServiceUnregisterEvent instead of plugin enable/disable, whoops.

from treasury.

lokka30 avatar lokka30 commented on August 15, 2024

Maybe even add a isMigratingEconomyProvider so that we can check?

I assume if you wanted to check you could check the implementing class. I guess you could include it as part of the API, but it seems like a very particular use thing that I'm not sure belongs. Your average plugin shouldn't care, they'll just see that the transaction fails and that's that. It's such a rare case too, I sincerely doubt you'd be converting more than maybe once a year if you happen to have particularly bad luck with economy providers.

But how would we handle operations that already started?

Probably would need some sort of EconomyProvider#awaitPendingQueries, but this also overall seems like one of those overkill situations - even the slowest of response times is unlikely to exceed a second, so what are the odds that someone started a transaction that will coincide with your once-per-year economy migration? Additionally, bad actors who just grab and hang onto the first available EconomyProvider instead of reobtaining it as necessary can still create new queries using the old economy instance unless the provider actually verifies that it's still registered every single time it's used.

Speaking of I need to go back and change my RegisteredServiceProvider usage for Vault integrations to listen to the ServiceRegisterEvent and ServiceUnregisterEvent instead of plugin enable/disable, whoops.

Since the migrator withdraws the money from the previous provider, I think it is fine if we do it completely async and don't worry about any transactions that occur during the migration process as the user can just migrate again to get the new balances in.

Also - migrating economies whilst users are on - doesn't sound like a good idea to me anyways 😄

from treasury.

lokka30 avatar lokka30 commented on August 15, 2024

Note: This issue is being addressed in #37.

from treasury.

Related Issues (20)

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.