< 272022-07-28⋎29 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
10:11FarmerEd[m] Working on a settings menu for a module, but some settings won't update till cache is cleared.
10:11FarmerEd[m]Using drupal_flush_all_caches(); on save works, but I'm wondering if it should be used?
10:45mstenta[m]Farmer Ed: i don't think there's any harm. It is a heavy process to rebuild everything, but probably not terrible if it's only on settings form save
10:46mstenta[m]Could try to find a more targeted method, to rebuild only what you need
10:47mstenta[m]What are you rebuilding? Menus? Routes?
10:47FarmerEd[m]Menues
10:47FarmerEd[m]Menus
10:48FarmerEd[m]It may be a bit heavy alright, but wouldn't expect it to be changed too often either
10:49mstenta[m]I'm sure there's a targeted way to do that, but I don't know what it is :-)
10:49FarmerEd[m]would it be render cache?
10:53mstenta[m]No that's its own thing
10:53mstenta[m]Lots of caches :-)
10:54FarmerEd[m]OK..............
10:54FarmerEd[m]But it seems to be working
10:55FarmerEd[m]\Drupal::service('cache.render')->invalidateAll();
10:56FarmerEd[m]and it saves considerably quicker
11:13FarmerEd[m]also tried
11:13FarmerEd[m]\\Drupal::cache('menu')->invalidateAll()
11:13FarmerEd[m]but it didn't work
11:21mstenta[m]Well if it works 🤷
11:22mstenta[m]I stand corrected
11:23FarmerEd[m]I think I will do some more testing, perhaps on a clean install later just to be sure.
11:26FarmerEd[m]But thanks, the real question was whether or not clearing the cache like this would be poor practice, so I suppose clearing the smallest portion possible is the answer.
15:55mstenta[m]Hey can't make the call today
19:13symbioquine[m]www.youtube.com/watch?v=hIOrNcLZRhc
20:40FarmerEd[m]symbioquine: I tried the calendar event ID option with the Google API, it prevents duplicate events being created alright unfortunately it does not overwrite by default, so will need to apply some logic to delete any existing event then post the new event in the case of updates.
20:43symbioquine[m]Can you catch the failed create and issue an update if the exception or response code indicates a duplicate? I think that would produce better failure modes.
20:48FarmerEd[m]Yes, of course, that would make more sense.
20:48symbioquine[m]Ideally it should return an [HTTP 409](developer.mozilla.org/en-US/docs/Web/HTT) error with a suitable error message.
20:48FarmerEd[m]events` resulted in a `409 Conflict` response: { "error": { "errors": [ { "domain": "global", "reason": "duplicate
20:49symbioquine[m]🤓
20:49FarmerEd[m]and PATCH should be straight forward with the ID
20:49FarmerEd[m]PATCH www.googleapis.com/calendar/v3/calendars
20:50FarmerEd[m]Cool, that will make for a much more robust workflow
20:54symbioquine[m]I wish they'd explicitly document in the update/patch API docs what happens if you specify a non-existent eventId... Depending how it's implemented, it's possible that your use-case can just always patch or update - even for the initial creation...
20:54symbioquine[m]Then it wouldn't require the second call
20:55symbioquine[m]For anybody else following along, the docs in question are: developers.google.com/calendar/api/v3/re
20:55FarmerEd[m]I can try that first then
21:06FarmerEd[m]Well unsurprisingly PATCH works for update but not creation. But there is enough to keep me going for now
21:08symbioquine[m]How about update for creation?
21:09FarmerEd[m]? is PATCH not update
21:10FarmerEd[m]ah
21:10symbioquine[m]It looked like both exist as APIs
21:10FarmerEd[m]they have too many options
21:14FarmerEd[m]<symbioquine[m]> "🤓" <- Those glasses suit you
21:16FarmerEd[m]update is the winner
21:18symbioquine[m]Ha! Awesome!
21:19FarmerEd[m]leaves it simple,
21:19FarmerEd[m]only need to deal with the event if the calendar entry is no longer required now
21:19FarmerEd[m]but that can wit till tomorrow, so thanks v much.
21:20symbioquine[m]NP :)

< 272022-07-28⋏29 >