Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AOT-ify build and minor improvements #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atdixon
Copy link

@atdixon atdixon commented Dec 12, 2020

@vlaaad Cool project!

In evaluating cljfx I played around with your cljfx/hn reference project and ended fixing up a few things along the way. I'm happy to factor out any of these into a separate PR if you'd like any of these changes a la carte:

When I started the app, it seems it fanned out too many network requests at once and I hit the (in)famous "Too many open files" issue on my mac.

HTTP exceptions were emitted and dispatched to event/handle but the emitted exceptions did not have an ::event/type so there were Clojure errors about trying to do a multi-method dispatch on nil. To fix this, I changed the emitted exceptions to include an ::event/type ::event/exception and I added a simple (defmethod handle ::exception ...) to put the recent error into the :state so that the view would render any such errors in red.

Incidentally I thought this might be a common issue for others so to eliminate the actual HTTP exceptions, I limited the number of stories rendered (i.e., (take 100 ...).

Additionally I was curious about achieving an AOT build, so I added AOT as part of the uberjar build -- it involves leveraging the (Platform/exit) 'trick' you describe here (see build/..). This also required upgrading deps.edn to be compatible with recent clojure tooling as well as updating and using the latest seancornfield/depstar capabilities. This demo of AOT build may be interesting to other cljfx users!

I've tested all of this and updated the README to reflect these changes. If any of this is useful to you, great, just wanted to share these changes just in case. Thanks for the cool framework!

Copy link
Contributor

@vlaaad vlaaad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @atdixon, thanks for this contribution!
I would like to merge it, but I really want to keep this example as simple as possible. Can you please have a look at my concerns?

build/uberjar/build.clj Show resolved Hide resolved
src/hn/core.clj Outdated Show resolved Hide resolved
@atdixon atdixon force-pushed the minor-improvements-0 branch from 4f3e6ec to 6b9ae71 Compare December 14, 2020 23:35
@atdixon atdixon requested a review from vlaaad December 14, 2020 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants