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

Improvements for worker threads #3066

Open
1 task done
CrosRoad95 opened this issue Jun 15, 2023 · 0 comments
Open
1 task done

Improvements for worker threads #3066

CrosRoad95 opened this issue Jun 15, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@CrosRoad95
Copy link
Contributor

CrosRoad95 commented Jun 15, 2023

Is your feature request related to a problem? Please describe.

there are few functions that use worker thread to do the job, for example "passwordHash", i would like to suggest number of improvments.

Describe the solution you'd like

Main functionality we should add:

  1. Add option to specify how many worker threads you want, client could set it up, example default configuration should be 2/logical cores. Server side add it into mtaserver.conf <workerThreads>4</workerThreads>
  2. Make limit of how long worker thread can execute one function, let's say if passwordHash has cost=50 you probably made a mistake and it should stop executing after for example 30seconds.
  3. Add to the performance browser an information of how many task is in progress, how many is queued
  4. Improve argument parser by adding way to declare async functions that no longer accept callback, but they need to be executed from inside coroutine, see: https://discord.com/channels/801330706252038164/801819598717976606/1104385254610960474
local co = coroutine.create(function()
  iprint("hashing started at", getTickCount())
  iprint("result",passwordHashAsync("asd", "bcrypt", {}))
  iprint("hashing ended at", getTickCount())
end)
coroutine.resume(co)

Additionally:
5. Add "Task" userdata which represent background task, so can i cancel it, check status, get result
6. Add some option that will warn user if non asynchronous function is called when asynchronous variant is availiable - mainly for debugging
7. Add warning when too many tasks are waiting in queue simillar to warning when you have too many files open
maybe i will add more in future

Describe alternatives you've considered

/

Additional context

/

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@CrosRoad95 CrosRoad95 added the enhancement New feature or request label Jun 15, 2023
@patrikjuvonen patrikjuvonen changed the title Improvments for worker threads Improvements for worker threads Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant