digitallyinduced / ihp

🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness
https://ihp.digitallyinduced.com/
MIT License
4.89k stars 194 forks source link

Not clear if/when Jobs or Worker.hs are compiled #1112

Open amitaibu opened 2 years ago

amitaibu commented 2 years ago

When adding a new Job, if there's a compile error it's not reflected on the browser or on the terminal.

To reproduce:

  1. Via the IDE -> Code Gen -> Background Job -> Generate a Job called "Foo"
  2. Add some typo on the generated file

Selection_999(301)

Currently only my VScode notifies me there's some error, but it's not clear if compiling happens at all, and if so where's the output.

amitaibu commented 2 years ago

btw, even though I'm on local, I tried also

make build/bin/RunJobs
./build/bin/RunJobs   
Starting worker d0402832-2c84-45df-8953-beff5ab1c684
amitaibu commented 2 years ago

I have copied Main.hs from https://github.com/VoodooTeam/starboard-federator/blob/1b0f935a6666539cc1e111c20af2dfd5f395c52f/Main.hs . Here's the diff with my Main.hs

 module Main where
-import IHP.Prelude

 import Config
-import qualified IHP.Server
-import IHP.RouterSupport
 import IHP.FrameworkConfig
 import IHP.Job.Types
+import IHP.Prelude
+import IHP.RouterSupport
+import qualified IHP.Server
 import Web.FrontController
 import Web.Types
+import Web.Worker

 instance FrontController RootApplication where
-    controllers = [
-            mountFrontController WebApplication
-        ]
+  controllers =
+    [ mountFrontController WebApplication
+    ]

 instance Worker RootApplication where
-    workers _ = []
+  workers _ = workers WebApplication

And now Worker.hs is being compiled. I'm not sure why Main.hs is different (I'm on v 0.14), but closing...

amitaibu commented 2 years ago

Re-opening, as I've confirmed it's working also with a completely new project.

amitaibu commented 2 years ago

Closed as per https://github.com/digitallyinduced/ihp/issues/1116#issuecomment-938830500

amitaibu commented 2 years ago

Sorry, I was too quick to jump the gun. With the default Main.hs the Worker.hs doesn't seem to be included.