File tree Expand file tree Collapse file tree 1 file changed +23
-21
lines changed Expand file tree Collapse file tree 1 file changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -86,27 +86,6 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
86
86
unreachable ! ( ) ;
87
87
} ;
88
88
89
- let mut config = match T :: get_entry ( & cosmic_config) {
90
- Ok ( config) => config,
91
- Err ( ( errors, default) ) => {
92
- if !errors. is_empty ( ) {
93
- eprintln ! ( "Error getting config: {config_id} {errors:?}" ) ;
94
- }
95
- default
96
- }
97
- } ;
98
-
99
- if let Err ( err) = tx
100
- . send ( Update {
101
- errors : Vec :: new ( ) ,
102
- keys : Vec :: new ( ) ,
103
- config : config. clone ( ) ,
104
- } )
105
- . await
106
- {
107
- eprintln ! ( "Failed to send config: {err}" ) ;
108
- }
109
-
110
89
let mut attempts = 0 ;
111
90
112
91
loop {
@@ -168,6 +147,29 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
168
147
let mut owner_changed = owner_changed
169
148
. map ( |c| Change :: OwnerChanged ( c. is_some ( ) ) )
170
149
. fuse ( ) ;
150
+
151
+ // update now, just in case we missed changes while setting up stream
152
+ let mut config = match T :: get_entry ( & cosmic_config) {
153
+ Ok ( config) => config,
154
+ Err ( ( errors, default) ) => {
155
+ if !errors. is_empty ( ) {
156
+ eprintln ! ( "Error getting config: {config_id} {errors:?}" ) ;
157
+ }
158
+ default
159
+ }
160
+ } ;
161
+
162
+ if let Err ( err) = tx
163
+ . send ( Update {
164
+ errors : Vec :: new ( ) ,
165
+ keys : Vec :: new ( ) ,
166
+ config : config. clone ( ) ,
167
+ } )
168
+ . await
169
+ {
170
+ eprintln ! ( "Failed to send config: {err}" ) ;
171
+ }
172
+
171
173
loop {
172
174
let change: Changed = futures:: select! {
173
175
c = changes. next( ) => {
You can’t perform that action at this time.
0 commit comments