mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-15 22:26:40 +02:00
more ticker improvements
This commit is contained in:
parent
c173ebf5b9
commit
df050472a1
@ -58,7 +58,9 @@ func (gui *Gui) WithWaitingStatus(name string, f func() error) error {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(time.Millisecond * 50) {
|
ticker := time.NewTicker(time.Millisecond * 50)
|
||||||
|
defer ticker.Stop()
|
||||||
|
for range ticker.C {
|
||||||
appStatus := gui.statusManager.getStatusString()
|
appStatus := gui.statusManager.getStatusString()
|
||||||
gui.Log.Warn(appStatus)
|
gui.Log.Warn(appStatus)
|
||||||
if appStatus == "" {
|
if appStatus == "" {
|
||||||
|
@ -788,9 +788,11 @@ func (gui *Gui) renderGlobalOptions() error {
|
|||||||
|
|
||||||
func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function func() error) {
|
func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function func() error) {
|
||||||
go func() {
|
go func() {
|
||||||
|
ticker := time.NewTicker(interval)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-time.Tick(interval):
|
case <-ticker.C:
|
||||||
_ = function()
|
_ = function()
|
||||||
case <-stop:
|
case <-stop:
|
||||||
return
|
return
|
||||||
|
@ -78,8 +78,10 @@ func (m *ViewBufferManager) NewCmdTask(cmd *exec.Cmd, linesToRead int) func(chan
|
|||||||
loaded := false
|
loaded := false
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
ticker := time.NewTicker(time.Millisecond * 100)
|
||||||
|
defer ticker.Stop()
|
||||||
select {
|
select {
|
||||||
case <-time.Tick(time.Millisecond * 100):
|
case <-ticker.C:
|
||||||
if !loaded {
|
if !loaded {
|
||||||
m.beforeStart()
|
m.beforeStart()
|
||||||
m.writer.Write([]byte("loading..."))
|
m.writer.Write([]byte("loading..."))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user