Add 2 parameters to Start-ThreadJob: timeout seconds, priority

Aperta
#26 43 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
24/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
powershell
Ambito
backend

Direzione di ricerca

Start by reading the Start-ThreadJob implementation and its tests to understand how jobs are created and scheduled; the issue names no files or tests. The requested work is adding timeout seconds and priority parameters, with priority 1 running first and a default of 5. Define what happens when a timeout expires, including whether the job is removed, then add coverage for the agreed behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary of the new feature / enhancement

Add 2 parameters to Start-ThreadJob: timeout seconds, priority

Proposed technical implementation details (optional)

priority:

A single asynchronous task has no timeout and no priority, It is very original.

The priority range is 1-9, and the default is 5,priority 1 will be executed first.


timeoutseconds:

For that things, I think thread-timeout is a good medicine:

  • can not stop Invoke-WebRequest / Invoke-RestMethod by ctrl + c .see:
    https://github.com/PowerShell/PowerShell/issues/16145
  • “Shit-mountain-code”
  • HANG
    The regularity of unpredictable execution time
  • Regular expression for a long time and unpredictable time.
  • Code executed remotely.
  • memory leaks
  • cpu 100%

like:
golang : “context.WithTimeout”
python : timeout* in threading lib

It is better to add a Boolean type of parameter : -AutoRemoveJob
whether to automatically remove threadjob after timeout,
parameter likes “receive-job -AutoRemoveJob”
In this way, users can only consider new thread and put ps1 script code.

both "ForEach-Object -Parallel" and "Start-ThreadJob" without timeout, This has seriously affected my development of "kasini3000" at present.

Powershell community do a "engine",i do a "car". the car is kasini3000 and k4t .
I love powershell. I want to give my opinion to the engine.
I hope the engine factory can transform a better engine.
I think timeoutseconds can make the ps1 script in the thread more robust.
I hope powershell will become stronger and stronger.

Lingua principale
PowerShell
Stelle
37
Fork
22
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PowerShell/ThreadJob

Tutte le issue di PowerShell/ThreadJob

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.