@@ -176,7 +176,7 @@ func New(options Options) Agent {
176
176
ignorePorts : options .IgnorePorts ,
177
177
portCacheDuration : options .PortCacheDuration ,
178
178
reportMetadataInterval : options .ReportMetadataInterval ,
179
- notificationBannersRefreshInterval : options .ServiceBannerRefreshInterval ,
179
+ announcementBannersRefreshInterval : options .ServiceBannerRefreshInterval ,
180
180
sshMaxTimeout : options .SSHMaxTimeout ,
181
181
subsystems : options .Subsystems ,
182
182
addresses : options .Addresses ,
@@ -193,7 +193,7 @@ func New(options Options) Agent {
193
193
// that gets closed on disconnection. This is used to wait for graceful disconnection from the
194
194
// coordinator during shut down.
195
195
close (a .coordDisconnected )
196
- a .notificationBanners .Store (new ([]codersdk.BannerConfig ))
196
+ a .announcementBanners .Store (new ([]codersdk.BannerConfig ))
197
197
a .sessionToken .Store (new (string ))
198
198
a .init ()
199
199
return a
@@ -234,8 +234,8 @@ type agent struct {
234
234
manifest atomic.Pointer [agentsdk.Manifest ] // manifest is atomic because values can change after reconnection.
235
235
reportMetadataInterval time.Duration
236
236
scriptRunner * agentscripts.Runner
237
- notificationBanners atomic.Pointer [[]codersdk.BannerConfig ] // notificationBanners is atomic because it is periodically updated.
238
- notificationBannersRefreshInterval time.Duration
237
+ announcementBanners atomic.Pointer [[]codersdk.BannerConfig ] // announcementBanners is atomic because it is periodically updated.
238
+ announcementBannersRefreshInterval time.Duration
239
239
sessionToken atomic.Pointer [string ]
240
240
sshServer * agentssh.Server
241
241
sshMaxTimeout time.Duration
@@ -274,7 +274,7 @@ func (a *agent) init() {
274
274
sshSrv , err := agentssh .NewServer (a .hardCtx , a .logger .Named ("ssh-server" ), a .prometheusRegistry , a .filesystem , & agentssh.Config {
275
275
MaxTimeout : a .sshMaxTimeout ,
276
276
MOTDFile : func () string { return a .manifest .Load ().MOTDFile },
277
- NotificationBanners : func () * []codersdk.BannerConfig { return a .notificationBanners .Load () },
277
+ AnnouncementBanners : func () * []codersdk.BannerConfig { return a .announcementBanners .Load () },
278
278
UpdateEnv : a .updateCommandEnv ,
279
279
WorkingDirectory : func () string { return a .manifest .Load ().Directory },
280
280
})
@@ -709,26 +709,26 @@ func (a *agent) setLifecycle(state codersdk.WorkspaceAgentLifecycle) {
709
709
// (and must be done before the session actually starts).
710
710
func (a * agent ) fetchServiceBannerLoop (ctx context.Context , conn drpc.Conn ) error {
711
711
aAPI := proto .NewDRPCAgentClient (conn )
712
- ticker := time .NewTicker (a .notificationBannersRefreshInterval )
712
+ ticker := time .NewTicker (a .announcementBannersRefreshInterval )
713
713
defer ticker .Stop ()
714
714
for {
715
715
select {
716
716
case <- ctx .Done ():
717
717
return ctx .Err ()
718
718
case <- ticker .C :
719
- bannersProto , err := aAPI .GetNotificationBanners (ctx , & proto.GetNotificationBannersRequest {})
719
+ bannersProto , err := aAPI .GetAnnouncementBanners (ctx , & proto.GetAnnouncementBannersRequest {})
720
720
if err != nil {
721
721
if ctx .Err () != nil {
722
722
return ctx .Err ()
723
723
}
724
724
a .logger .Error (ctx , "failed to update notification banners" , slog .Error (err ))
725
725
return err
726
726
}
727
- banners := make ([]codersdk.BannerConfig , 0 , len (bannersProto .NotificationBanners ))
728
- for _ , bannerProto := range bannersProto .NotificationBanners {
727
+ banners := make ([]codersdk.BannerConfig , 0 , len (bannersProto .AnnouncementBanners ))
728
+ for _ , bannerProto := range bannersProto .AnnouncementBanners {
729
729
banners = append (banners , agentsdk .BannerConfigFromProto (bannerProto ))
730
730
}
731
- a .notificationBanners .Store (& banners )
731
+ a .announcementBanners .Store (& banners )
732
732
}
733
733
}
734
734
}
@@ -763,15 +763,15 @@ func (a *agent) run() (retErr error) {
763
763
connMan .start ("init notification banners" , gracefulShutdownBehaviorStop ,
764
764
func (ctx context.Context , conn drpc.Conn ) error {
765
765
aAPI := proto .NewDRPCAgentClient (conn )
766
- bannersProto , err := aAPI .GetNotificationBanners (ctx , & proto.GetNotificationBannersRequest {})
766
+ bannersProto , err := aAPI .GetAnnouncementBanners (ctx , & proto.GetAnnouncementBannersRequest {})
767
767
if err != nil {
768
768
return xerrors .Errorf ("fetch service banner: %w" , err )
769
769
}
770
- banners := make ([]codersdk.BannerConfig , 0 , len (bannersProto .NotificationBanners ))
771
- for _ , bannerProto := range bannersProto .NotificationBanners {
770
+ banners := make ([]codersdk.BannerConfig , 0 , len (bannersProto .AnnouncementBanners ))
771
+ for _ , bannerProto := range bannersProto .AnnouncementBanners {
772
772
banners = append (banners , agentsdk .BannerConfigFromProto (bannerProto ))
773
773
}
774
- a .notificationBanners .Store (& banners )
774
+ a .announcementBanners .Store (& banners )
775
775
return nil
776
776
},
777
777
)
0 commit comments