@@ -12,12 +12,11 @@ import (
1212 "time"
1313
1414 "github.com/apognu/gocal"
15- "github.com/cedi/icaltest /pkg/errors"
15+ "github.com/cedi/meeting_epd /pkg/errors"
1616 "github.com/spf13/viper"
1717 "github.com/uptrace/opentelemetry-go-extra/otelzap"
18- timestamppb "google.golang.org/protobuf/types/known/timestamppb"
1918
20- pb "github.com/cedi/icaltest /pkg/protos"
19+ pb "github.com/cedi/meeting_epd /pkg/protos"
2120)
2221
2322type ICalClient struct {
@@ -59,14 +58,14 @@ func NewICalClient(zapLog *otelzap.Logger) *ICalClient {
5958 zapLog : zapLog ,
6059 cacheExpiration : time .Now (),
6160 cache : & pb.CalendarResponse {
62- LastUpdated : timestamppb .Now (),
61+ LastUpdated : time .Now (). Unix (),
6362 },
6463 }
6564}
6665
6766func (e * ICalClient ) FetchEvents (ctx context.Context ) {
6867 response := & pb.CalendarResponse {
69- LastUpdated : timestamppb .Now (),
68+ LastUpdated : time .Now (). Unix (),
7069 Entries : make ([]* pb.CalendarEntry , 0 ),
7170 }
7271
@@ -90,7 +89,7 @@ func (e *ICalClient) FetchEvents(ctx context.Context) {
9089 }
9190
9291 eventsMux .Lock ()
93- response .LastUpdated = timestamppb .Now ()
92+ response .LastUpdated = time .Now (). Unix ()
9493 response .Entries = append (response .Entries , events ... )
9594 eventsMux .Unlock ()
9695
@@ -100,6 +99,10 @@ func (e *ICalClient) FetchEvents(ctx context.Context) {
10099 }()
101100 }
102101
102+ eventsMux .Lock ()
103+ response .CalendarEntries = int32 (len (response .Entries ))
104+ eventsMux .Unlock ()
105+
103106 wg .Wait ()
104107 e .cache = response
105108}
@@ -198,8 +201,8 @@ func NewCalendarEntryFromGocalEvent(e gocal.Event) *pb.CalendarEntry {
198201
199202 return & pb.CalendarEntry {
200203 Title : e .Summary ,
201- Start : timestamppb . New ( start ),
202- End : timestamppb . New ( end ),
204+ Start : start . Unix ( ),
205+ End : end . Unix ( ),
203206 AllDay : allDay ,
204207 Busy : busy ,
205208 }
0 commit comments