ProcessJobs drains all pending scheduled jobs. Call this regularly (e.g., inside Loop or Await) to allow resolve/reject handlers to run.
()
| 113 | // ProcessJobs drains all pending scheduled jobs. |
| 114 | // Call this regularly (e.g., inside Loop or Await) to allow resolve/reject handlers to run. |
| 115 | func (ctx *Context) ProcessJobs() { |
| 116 | if ctx == nil || ctx.jobQueue == nil { |
| 117 | return |
| 118 | } |
| 119 | for { |
| 120 | select { |
| 121 | case job := <-ctx.jobQueue: |
| 122 | if job != nil { |
| 123 | job(ctx) |
| 124 | } |
| 125 | default: |
| 126 | return |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func (ctx *Context) drainJobs() { |
| 132 | if ctx == nil || ctx.jobQueue == nil { |
no outgoing calls