One of the limitations of Hexe services is that they use a simple request-response architecture; each request is supposed to be relatively fast (less than 30 seconds) or else it risks timing out.

Longer tasks are supposed to be handled by an underlying archon, implemented in C++, using a session architecture. But what if we could implement a session architecture with Hexe?

Imagine the following:

  • We add a function that submits a task (written in HexeLisp) to execute in the background. The function returns a task ID, which is returned to the client.
  • Each task has a property bag which can be accessed both by the running task and by any subsequent client class. The property bag is accessed through special functions so that we can protect it with mutexes.
  • The client is responsible for calling back periodically and asking for the status of the task (by ID).
  • With a little extra work, we can have an arbitrary number of threads running on the same task (the same property bag).
  • We can of course add quotas, time-outs, etc. to make sure we don't suck up all resources.