From 5cc0c441512237873035365b01b5495134ba41bc Mon Sep 17 00:00:00 2001 From: Prashant Gupta Date: Thu, 28 Mar 2019 13:38:01 -0700 Subject: [PATCH] updated tracker activity code --- go.mod | 4 ++-- go.sum | 8 ++++++++ pkg/mousemover/mouseMover.go | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 575e1e1..5e74881 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/go-stack/stack v1.8.0 // indirect github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca github.com/oxtoacart/bpool v0.0.0-20190227141107-8c4636f812cc // indirect - github.com/prashantgupta24/activity-tracker v0.3.1 + github.com/prashantgupta24/activity-tracker v0.4.0 github.com/sirupsen/logrus v1.4.0 - github.com/stretchr/testify v1.2.2 + github.com/stretchr/testify v1.3.0 ) diff --git a/go.sum b/go.sum index 86d6c83..e5f1e9a 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,7 @@ github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e h1:4ZrkT/RzpnRO github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k= github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 h1:UUppSQnhf4Yc6xGxSkoQpPhb7RVzuv5Nb1mwJ5VId9s= github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/gosx-notifier v0.0.0-20180201035817-e127226297fb h1:6S+TKObz6+Io2c8IOkcbK4Sz7nj6RpEVU7TkvmsZZcw= @@ -26,6 +27,7 @@ github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-vgo/robotgo v0.0.0-20190311142943-193b4935d4b1/go.mod h1:jRysmxT/HqVgkZAFBsYVjLHRrsrEUUKx19xHLNPVYM0= github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca h1:TUqm5e4QD14kygf1AkXLxcn6sBdhh2SuEjPXaFrwEis= github.com/go-vgo/robotgo v0.0.0-20190321150332-9d92e0f852ca/go.mod h1:btNdXfFVS5B5p/iqUKRaaSuJfETYNbMv6wG8fL2onK0= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= @@ -40,6 +42,9 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantgupta24/activity-tracker v0.3.1 h1:+jKFqnve2316ZgWgrYgd+go+ocphaN3EgfeEMfW7lhA= github.com/prashantgupta24/activity-tracker v0.3.1/go.mod h1:hZjTk+hYxhxGutmSNiFTk3+OebO3RTNki5gA/5hIPkM= +github.com/prashantgupta24/activity-tracker v0.4.0 h1:wIsVFIo4h8GSe08QTPRbqEfBeAjX16WHdFOUb98MKCw= +github.com/prashantgupta24/activity-tracker v0.4.0/go.mod h1:erO/ZDFDjCvt8BgqWwYkFggJOcrwjGGROcM0WwYRwzE= +github.com/robotn/gohook v0.0.0-20190305192954-bbbbefb5ff85/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4= github.com/robotn/gohook v0.0.0-20190315174547-bc414970f3d6 h1:XTKPqoPYwgasmAWhtpolldqBpnbpgH6iAtQPReXiywA= github.com/robotn/gohook v0.0.0-20190315174547-bc414970f3d6/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4= github.com/shirou/gopsutil v0.0.0-20190131151121-071446942108 h1:XXgDK65TPH+Qbo2sdYHldM5avclwThBXVYZHxroFkTQ= @@ -48,9 +53,12 @@ github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+D github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/sirupsen/logrus v1.4.0 h1:yKenngtzGh+cUSSh6GWbxW2abRqhYUSR/t/6+2QqNvE= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa h1:kOg2u5TN+l2IBl4Q0Xm3bZRQ5gK3zGXRi/24XT8L7FI= github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa/go.mod h1:D+Ywq+8bsOIg4nUk1lgHtPGxYxknhySi/HfZjG7VN/g= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= diff --git a/pkg/mousemover/mouseMover.go b/pkg/mousemover/mouseMover.go index 8a068d6..a8ab5df 100644 --- a/pkg/mousemover/mouseMover.go +++ b/pkg/mousemover/mouseMover.go @@ -30,7 +30,7 @@ func (m *MouseMover) Start() { } m.quit = make(chan struct{}) - frequency := 5 //value always in seconds + frequency := 60 //value always in seconds activityTracker := &tracker.Instance{ Frequency: frequency, //LogLevel: "debug", //if we want verbose logging @@ -44,7 +44,7 @@ func (m *MouseMover) Start() { for { select { case heartbeat := <-heartbeatCh: - if !heartbeat.IsActivity { + if !heartbeat.WasAnyActivity { commCh := make(chan bool) go moveMouse(movePixel, commCh) select {