diff --git a/DONATIONS.md b/DONATIONS.md
index a4483485..24e51883 100644
--- a/DONATIONS.md
+++ b/DONATIONS.md
@@ -26,7 +26,7 @@ I'm grateful for all the generous donations. Iris is fully funded by these dona
- [Ryan Brooks](https://github.com/ryanbyyc) donated 50 EUR at May 11
- [Juan Sebastián Suárez Valencia](https://github.com/Juanses) donated 20 EUR at September 11
-- Anonymous(PRIVACY PROTECTION) donated 20 EUR at September 16
+- [Bob Lee](https://github.com/li3p) donated 20 EUR at September 16
> The name of the donator added after his/her permission.
diff --git a/HISTORY.md b/HISTORY.md
index 0a2958ce..2bba236c 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -2,6 +2,10 @@
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris`.
+## 4.2.5 -> 4.2.6
+
+- **CHANGE**: Updater (See 4.2.4 and 4.2.3) runs in its own goroutine now, unless the `iris.Config.CheckForUpdatesSync` is true.
+
## 4.2.4 -> 4.2.5
- **ADDED**: `iris.CheckForUpdates(force bool)` which can run the updater(look 4.2.4) at runtime too, updater is tested and worked at dev machine.
diff --git a/README.md b/README.md
index 3ca7728e..504755e9 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
-
+
@@ -181,7 +181,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
Versioning
------------
-Current: **v4.2.5**
+Current: **v4.2.6**
> Iris is an active project
@@ -224,7 +224,7 @@ License can be found [here](LICENSE).
[Travis]: http://travis-ci.org/kataras/iris
[License Widget]: https://img.shields.io/badge/license-Apache%202.0%20%20-E91E63.svg?style=flat-square
[License]: https://github.com/kataras/iris/blob/master/LICENSE
-[Release Widget]: https://img.shields.io/badge/release-v4.2.5-blue.svg?style=flat-square
+[Release Widget]: https://img.shields.io/badge/release-v4.2.6-blue.svg?style=flat-square
[Release]: https://github.com/kataras/iris/releases
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
[Chat]: https://kataras.rocket.chat/channel/iris
diff --git a/configuration.go b/configuration.go
index 2b536357..1252e478 100644
--- a/configuration.go
+++ b/configuration.go
@@ -47,7 +47,8 @@ type Configuration struct {
// the updater, will notify the dev/user that the update is finished and should restart the App manually.
// Notes:
// 1. Experimental feature
- // 2. If setted to true, the app will have a little startup delay
+ // 2. If setted to true, the app will start the server normally and runs the updater in its own goroutine,
+ // for a sync operation see CheckForUpdatesSync.
// 3. If you as developer edited the $GOPATH/src/github/kataras or any other Iris' Go dependencies at the past
// then the update process will fail.
//
@@ -56,6 +57,14 @@ type Configuration struct {
// app := iris.New(iris.OptionCheckForUpdates(true))
// Default is false
CheckForUpdates bool
+ // CheckForUpdatesSync checks for updates before server starts, it will have a little delay depends on the machine's download's speed
+ // See CheckForUpdates for more
+ // Notes:
+ // 1. you could use the CheckForUpdatesSync while CheckForUpdates is false, set this or CheckForUpdates to true not both
+ // 2. if both CheckForUpdates and CheckForUpdatesSync are setted to true then the updater will run in sync mode, before server server starts.
+ //
+ // Default is false
+ CheckForUpdatesSync bool
// DisablePathCorrection corrects and redirects the requested path to the registed path
// for example, if /home/ path is requested but no handler for this Route found,
@@ -187,6 +196,18 @@ var (
}
}
+ // CheckForUpdatesSync checks for updates before server starts, it will have a little delay depends on the machine's download's speed
+ // See CheckForUpdates for more
+ // Notes:
+ // 1. you could use the CheckForUpdatesSync while CheckForUpdates is false, set this or CheckForUpdates to true not both
+ // 2. if both CheckForUpdates and CheckForUpdatesSync are setted to true then the updater will run in sync mode, before server server starts.
+ //
+ // Default is false
+ OptionCheckForUpdatesSync = func(val bool) OptionSet {
+ return func(c *Configuration) {
+ c.CheckForUpdatesSync = val
+ }
+ }
// OptionDisablePathCorrection corrects and redirects the requested path to the registed path
// for example, if /home/ path is requested but no handler for this Route found,
@@ -330,6 +351,7 @@ var (
func DefaultConfiguration() Configuration {
return Configuration{
CheckForUpdates: false,
+ CheckForUpdatesSync: false,
DisablePathCorrection: DefaultDisablePathCorrection,
DisablePathEscape: DefaultDisablePathEscape,
DisableBanner: false,
diff --git a/iris.go b/iris.go
index 6738d8a2..50c63e07 100644
--- a/iris.go
+++ b/iris.go
@@ -78,7 +78,7 @@ import (
const (
// Version is the current version of the Iris web framework
- Version = "4.2.5"
+ Version = "4.2.6"
banner = ` _____ _
|_ _| (_)
@@ -288,8 +288,10 @@ func (s *Framework) initialize() {
// updates, to cover the default station's irs.Config.checkForUpdates
// note: we could use the IsDevelopment configuration field to do that BUT
// the developer may want to check for updates without, for example, re-build template files (comes from IsDevelopment) on each request
- if s.Config.CheckForUpdates {
+ if s.Config.CheckForUpdatesSync {
s.CheckForUpdates(false)
+ } else if s.Config.CheckForUpdates {
+ go func() { s.CheckForUpdates(false) }()
}
}