Skip to content

Commit 162795c

Browse files
committed
Change parameter to be in seconds.
Signed-off-by: Antonio Jesus Navarro Perez <[email protected]>
1 parent 284bb2c commit 162795c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/gitbase/command/server.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type Server struct {
4747
Port int `short:"p" long:"port" default:"3306" description:"Port where the server is going to listen"`
4848
User string `short:"u" long:"user" default:"root" description:"User name used for connection"`
4949
Password string `short:"P" long:"password" default:"" description:"Password used for connection"`
50-
ConnTimeout time.Duration `short:"t" long:"timeout" env:"GITBASE_CONNECTION_TIMEOUT" description:"Timeout used for connections"`
50+
ConnTimeout int `short:"t" long:"timeout" env:"GITBASE_CONNECTION_TIMEOUT" description:"Timeout in seconds used for connections"`
5151
IndexDir string `short:"i" long:"index" default:"/var/lib/gitbase/index" description:"Directory where the gitbase indexes information will be persisted." env:"GITBASE_INDEX_DIR"`
5252
CacheSize cache.FileSize `long:"cache" default:"512" description:"Object cache size in megabytes" env:"GITBASE_CACHESIZE_MB"`
5353
Parallelism uint `long:"parallelism" description:"Maximum number of parallel threads per table. By default, it's the number of CPU cores. 0 means default, 1 means disabled."`
@@ -148,14 +148,15 @@ func (c *Server) Execute(args []string) error {
148148
}
149149

150150
hostString := net.JoinHostPort(c.Host, strconv.Itoa(c.Port))
151+
timeout := time.Duration(c.ConnTimeout) * time.Second
151152
s, err := server.NewServer(
152153
server.Config{
153154
Protocol: "tcp",
154155
Address: hostString,
155156
Auth: auth,
156157
Tracer: tracer,
157-
ConnReadTimeout: c.ConnTimeout,
158-
ConnWriteTimeout: c.ConnTimeout,
158+
ConnReadTimeout: timeout,
159+
ConnWriteTimeout: timeout,
159160
},
160161
c.engine,
161162
gitbase.NewSessionBuilder(c.pool,

docs/using-gitbase/configuration.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| `GITBASE_LANGUAGE_CACHE_SIZE`| size of the cache for the `language` UDF. The size is the maximum number of elements kept in the cache, 10000 by default |
1515
| `GITBASE_UAST_CACHE_SIZE` | size of the cache for the `uast` and `uast_mode` UDFs. The size is the maximum number of elements kept in the cache, 10000 by default |
1616
| `GITBASE_CACHESIZE_MB` | size of the cache for git objects specified as MB |
17-
| `GITBASE_CONNECTION_TIMEOUT` | timeout used for client connections on write and reads. No timeout by default. |
17+
| `GITBASE_CONNECTION_TIMEOUT` | timeout in seconds used for client connections on write and reads. No timeout by default. |
1818

1919
### Jaeger tracing variables
2020

@@ -75,7 +75,7 @@ Help Options:
7575
-p, --port= Port where the server is going to listen (default: 3306)
7676
-u, --user= User name used for connection (default: root)
7777
-P, --password= Password used for connection
78-
-t, --timeout= Timeout used for connections [$GITBASE_CONNECTION_TIMEOUT]
78+
-t, --timeout= Timeout in seconds used for connections [$GITBASE_CONNECTION_TIMEOUT]
7979
-i, --index= Directory where the gitbase indexes information will be persisted. (default:
8080
/var/lib/gitbase/index) [$GITBASE_INDEX_DIR]
8181
--cache= Object cache size in megabytes (default: 512) [$GITBASE_CACHESIZE_MB]
@@ -89,5 +89,4 @@ Help Options:
8989
--no-siva disable the load of siva files.
9090
-v Activates the verbose mode
9191
92-
9392
```

0 commit comments

Comments
 (0)