Commit Graph

11 Commits

Author SHA1 Message Date
Sebastian Crane bfd321cdb3 Add build system
This commit adds support for generating POM files and builds of matchbot
as JAR or uberjar (standalone JAR) files.

Resolves issue LibreGaming/matchbot#3

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-04-09 21:48:42 +01:00
Sebastian Crane 7fc472c269 Remove superfluous utilisation of 'do' forms
Since defn evaluates the expressions it its body in the same way as do,
this commit removes the superfluous uses of do where it appears directly
as a function body.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-04-09 22:46:18 +02:00
Sebastian Crane 6a594c5ad3 Use strings instead of keywords for game names
This commit changes the internal representation of game names in the
state data to be strings instead of keywords. This fixes a potential
memory leak relating to games that no longer have any players, since
strings, unlike keywords, are garbage collected when no longer in use.

Resolves issue LibreGaming/matchbot#2

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-30 12:11:10 +01:00
Sebastian Crane 6cce43f137 Move processing out of clojure.data.json/read call
This commit removes from the call to clojure.data.json/read the
conversion of the serialised list of players into a Clojure set, and
adds an independent function to do this task instead.

Since the structure of the serialised data is known in advance, the
recursive characteristics of clojure.data.json are not needed.

Resolves issue LibreGaming/matchbot#4

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-28 21:52:52 +01:00
Sebastian Crane 91cbdb69da Simplify the system start and restart functions
This commit changes the binding name of system/start's argument to
_ (since it is currently not used within the function), and simplifies
the system/restart function by not swapping the system Var's content
with nil before filling it with the new-created system state.

Eventually, these changes will be reverted when the initialisation of
the system is separated from the starting of that system, which will
mean that system/start will read its argument and that system/restart
will have to reinitialise the system state before restarting it.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-24 21:51:06 +00:00
Sebastian Crane fecd09c656 Remove unnecessary system/system function
A nil value acts as an empty map wherever a map value is expected. For
this reason, this commit removes the system/system function (which
returns an empty map), since a call to it can safely be replaced with a
nil value.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-22 22:51:59 +00:00
Sebastian Crane 0abd793fe7 Use a Var instead of an Atom for system state
The Atom's swap! function may run its provided function multiple
times. Because of this, using an Atom for the system state can
occasionally result in duplicate TCP connections being opened when the
system is started. These connections remain open until they
timeout (this is typically 5 minutes for IRC).

This commit changes the container for the system state from an Atom to a
Var, whose alter-var-root function (analogous to swap!) does not have
this issue.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-22 22:47:00 +00:00
Sebastian Crane 56094478db Remove use of state container in main function
Since the main function will only ever start and stop one system, this
commit simplifies the main function to use a single lexical binding for
the system state rather than creating an Atom.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-03-22 22:38:30 +00:00
Sebastian Crane 7857a1acf5 Add main function
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-02-19 23:33:01 +00:00
Sebastian Crane a2a041c9d1 Add 'Reloaded' system for interactive development
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-02-19 23:18:53 +00:00
Sebastian Crane fe660a8929 Add support for loading state and config files
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
2022-02-19 21:42:35 +00:00