Code Monkey home page Code Monkey logo

Comments (7)

asoseil avatar asoseil commented on May 10, 2024

os version and go version? I'm also on mac.
Can u see the file changed?
Can u post a screenshot?

from realize.

tehsphinx avatar tehsphinx commented on May 10, 2024

os: macOS Sierra Version 10.12.5
go: go version go1.8 darwin/amd64

Here the file with changed timestamps:

$ ls -la anna.go
-rw-r--r--  1 xx  staff  1809 Jul 26 13:15 anna.go
$ ls -la anna.go
-rw-r--r--  1 xx  staff  1812 Jul 27 10:58 anna.go
$ ls -la anna.go
-rw-r--r--  1 xx  staff  1809 Jul 27 10:59 anna.go

and the console output of realize run:

$ realize run
[10:53:15][myproject] : Watching 61 file/s 20 folder/s
[10:53:15][myproject] : Installing..
[10:53:16][myproject] : Installed after 1.493 s
[10:53:16][myproject] : Running..
[10:53:16][myproject] : Started after 0.002 s
[10:53:16][myproject] : 2017/07/27 10:53:16 Listening on port 50484
[10:58:13][myproject] : Ended
[10:58:13][myproject] : GO changed /Users/xx/go/src/myproject/anna.go
[10:58:13][myproject] : Installing..
[10:58:14][myproject] : Installed after 0.579 s
[10:58:14][myproject] : Running..
[10:58:14][myproject] : Started after 0.004 s
[10:58:14][myproject] : 2017/07/27 10:58:14 Listening on the port 50484

As you can see the change I made ist the output line "Listening on ...". When I change this line (or any other line) again and again realize does not react any more.

from realize.

asoseil avatar asoseil commented on May 10, 2024

Could you attach your server start function?

from realize.

tehsphinx avatar tehsphinx commented on May 10, 2024

you mean the main function?

func main() {
	settings.Init(conf.Settings)

	router := httprouter.New()

	Init1(router)
	Init2(router)

	srv := &http.Server{
		Addr:    ":" + port,
		Handler: router,
	}

	log.Println("Listening on port", port)
	log.Fatal(srv.ListenAndServe())
}

the Init functions will add handlers to the router and start go routines for other background routines.

Here is one of them:

func Init1(router *httprouter.Router) {
	b := bot.New()
	b.AddHandlers(router)

	ch, err := b.GetMessageChan()
	if err != nil {
		log.Println(err)
	}
	b.Run()

	go func(ch chan *bot.Message) {
		for msg := range ch {
			c := chatflow.Get(msg.Chat.ID)
			if err := c.Message(msg); err != nil {
				log.Println(err)
			}
		}
	}(ch)
}

from realize.

asoseil avatar asoseil commented on May 10, 2024

I tried even with the examples of httprouter but it works. I don't know, your problem could be caused by some pendant process, maybe related to the server listen

from realize.

manico avatar manico commented on May 10, 2024

Have the same problem.
It only detects change once per file.
If I swtich file and change then it works, but sequential changed to same file are not detected. :(

from realize.

asoseil avatar asoseil commented on May 10, 2024

@manico check #154 probably is related, we are working on it

from realize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.