File: day_176__thread_management.mdwn

package info (click to toggle)
git-annex 7.20190129-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 56,292 kB
  • sloc: haskell: 59,105; sh: 1,255; makefile: 225; perl: 136; ansic: 44
file content (13 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
Got back to hacking today, and did something I've wanted to do for some
time. Made all the assistant's threads be managed by a thread manager. This
allows restarting threads if they crash, by clicking a button in the
webapp. It also will allow for other features later, like stopping and
starting the watcher thread, to pause the assistant adding local files.

[[!img /assistant/crashrecovery.png]]

I added the haskell async library as a dependency, which made this pretty
easy to implement. The only hitch is that async's documentation is not
clear about how it handles asyncronous exceptions. It took me quite a while
to work out why the errors I'd inserted into threads to test were crashing
the whole program rather than being caught!